/* ============================================================
   قالب «مَرَح» (marah) — منصّة ناشر
   طابعٌ مرحٌ ودود لكتب الأطفال: رأسٌ بنفسجيّ، وأزرارٌ ورديّة،
   وزوايا مستديرة، وصورٌ دائريّة بإطارٍ متقطّع.
   كلّ التنسيق هنا، بلا مكتبات.
   ============================================================ */

:root {
  /* ألوان الهويّة (قيم تجريبيّة) */
  --store-primary: #6B3FA0;
  --store-primary-dark: #3B2F78;
  --store-accent: #CF2E68;
  --store-bg: #FFFFFF;
  --store-text: #2A2433;

  /* ألوان محايدة ثابتة، منها درجتان فاتحتان بنفسجيّتان للخلفيّات */
  --white: #FFFFFF;
  --tint: color-mix(in srgb, var(--store-primary) 7%, #FFFFFF);
  --tint-2: color-mix(in srgb, var(--store-primary) 14%, #FFFFFF);
  --muted: #625B6E;
  --line: #ECE8F2;
  --line-strong: #D6CFE2;
  --cover-bg: #F4F2F7;
  --gold: #F2A900;
  --on-dark: #FFFFFF;
  --on-dark-muted: #D9D2EA;

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

  --container: 1240px;
  --gutter: 16px;
  --radius: 18px;
  --radius-sm: 12px;
  --pill: 999px;
  --font: "Tajawal", "Segoe UI", Tahoma, sans-serif;
  --ease: cubic-bezier(.22,.61,.36,1);
  --shadow: 0 14px 34px rgba(59,47,120,.12);
}

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; scroll-padding-top: 150px; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.7; color: var(--store-text); background: var(--store-bg); overflow-x: clip; }
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-accent); 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: 28px; height: 28px; }

/* ---------- الشريط العلويّ ---------- */
.topbar { background: var(--store-primary-dark); color: var(--on-dark); font-size: 13px; }
.topbar .container { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 34px; }

/* ---------- الرأس ---------- */
.site-header { position: sticky; top: 0; z-index: 40; }
.header-main { background: var(--store-primary); color: var(--on-dark); }
.header-main .container { display: flex; align-items: center; gap: 20px; min-height: 78px; }
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand img { width: 46px; height: 46px; border-radius: 14px; }
.brand-name { font-size: 22px; font-weight: 800; line-height: 1.1; white-space: nowrap; }
.icon-btn { position: relative; width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; transition: background .2s; }
.header-main .icon-btn:hover { background: rgba(255,255,255,.14); }
.header-main .badge-count { top: 0; inset-inline-end: -4px; min-width: 15px; height: 15px; line-height: 15px; font-size: 10px; }
.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(--white); font-size: 11px; font-weight: 800; line-height: 19px; text-align: center; border: 2px solid var(--store-primary); box-sizing: content-box; }
.search-bar { flex: 1; display: flex; align-items: stretch; height: 48px; max-width: 620px; margin-inline: auto; background: var(--white); color: var(--store-text); border-radius: var(--pill); overflow: hidden; }
.search-cat { position: relative; display: flex; align-items: center; border-inline-end: 1px solid var(--line-strong); }
.search-cat select { appearance: none; -webkit-appearance: none; border: 0; background: transparent; padding: 0 18px 0 34px; height: 100%; font-size: 13.5px; font-weight: 700; color: var(--store-text); cursor: pointer; outline: none; max-width: 170px; }
.search-cat svg { position: absolute; inset-inline-end: 12px; pointer-events: none; color: var(--muted); }
.search-bar input { flex: 1; min-width: 0; border: 0; padding: 0 18px; outline: none; background: transparent; }
.search-btn { width: 54px; display: inline-flex; align-items: center; justify-content: center; color: var(--store-primary); transition: color .2s; }
.search-btn:hover { color: var(--store-accent); }
.header-actions { display: flex; align-items: center; gap: 4px; }
.header-help { display: inline-flex; align-items: center; gap: 10px; margin-inline-end: 10px; }
.header-help small { display: block; font-size: 11.5px; line-height: 1.2; color: var(--on-dark-muted); }
.header-help b { display: block; line-height: 1.2; font-size: 15px; }
.menu-toggle { color: var(--on-dark); }

/* شريط التصنيفات */
.cat-strip { background: var(--white); border-bottom: 1px solid var(--line); position: relative; z-index: 35; transition: box-shadow .3s; }
.cat-strip.is-scrolled { box-shadow: 0 8px 22px rgba(59,47,120,.08); }
.cat-strip .container { display: flex; align-items: center; gap: 16px; min-height: 54px; }
.cat-strip-list { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.cat-strip-list::-webkit-scrollbar { display: none; }
.cat-strip-list a { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 14px; border-radius: var(--pill); font-size: 14px; font-weight: 700; white-space: nowrap; transition: background .2s, color .2s; }
.cat-strip-list a:hover { background: var(--tint); color: var(--store-primary); }
.cat-strip-list img { width: 26px; height: 26px; border-radius: 50%; }
.help-btn { flex-shrink: 0; }

/* الدرج الجانبيّ */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(42,36,51,.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(--on-dark); }
.drawer-head .brand-name { font-size: 18px; }
.drawer-head .brand img { width: 38px; height: 38px; }
.drawer-head .icon-btn:hover { background: rgba(255,255,255,.15); }
.drawer-title { padding: 16px 18px 6px; font-size: 13px; font-weight: 800; color: var(--store-primary); }
.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, .drawer-nav a[aria-current="page"] { background: var(--tint); color: var(--store-primary); }
.drawer-cats a { display: flex; align-items: center; gap: 12px; padding: 8px 18px; font-weight: 500; }
.drawer-cats a:hover { background: var(--tint); }
.drawer-cats img { width: 30px; height: 30px; border-radius: 50%; }
.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 26px; font-weight: 800; font-size: 15px; border: 2px solid transparent; border-radius: var(--pill); transition: background .2s, color .2s, border-color .2s, transform .2s; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.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(--white); }
.btn-accent:hover { background: var(--store-primary-dark); }
.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-2); 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(--white); }
.btn-sm { min-height: 38px; padding: 0 18px; 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-accent); transition: gap .2s; white-space: nowrap; }
.link-more:hover { gap: 10px; }

/* ---------- عنوان القسم ---------- */
.section { padding-block: 44px; }
.section-head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; margin-bottom: 26px; }
.section-title { position: relative; font-size: 28px; color: var(--store-primary); padding-bottom: 12px; }
.section-title::after { content: ""; position: absolute; bottom: 0; inset-inline: 0; margin-inline: auto; width: 48px; height: 8px; background: radial-gradient(circle, var(--store-accent) 3px, transparent 3.5px) 0 0 / 16px 8px repeat-x; }
.section-sub { font-size: 14.5px; color: var(--muted); margin-top: 8px; }
.section-head.is-start { flex-direction: row; justify-content: space-between; align-items: flex-end; text-align: start; }
.section-head.is-start .section-title { font-size: 24px; }
.section-head.is-start .section-title::after { margin-inline: 0; }

/* ---------- التقييم والسعر ---------- */
.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: #DED7EA; }
.stars .half { fill: url(#half-gold); }
.price { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.price-now { font-weight: 800; font-size: 17px; color: var(--store-text); }
.price-old { font-size: 13px; color: var(--muted); text-decoration: line-through; }
.price.is-sale .price-now { color: var(--store-accent); }

/* ---------- بطاقة الكتاب ---------- */
.books-grid { --per-row: 4; display: grid; grid-template-columns: repeat(var(--per-row), minmax(0, 1fr)); gap: 26px 22px; }
body[data-books-per-row="3"] .books-grid { --per-row: 3; }
body[data-books-per-row="5"] .books-grid { --per-row: 5; }
body[data-books-per-row="6"] .books-grid { --per-row: 6; }
.book-card { position: relative; display: flex; flex-direction: column; }
.book-media { position: relative; aspect-ratio: 1 / 1; background: var(--cover-bg); border-radius: var(--radius); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.book-media > a { display: block; height: 82%; aspect-ratio: 2 / 3; }
.book-media > a > img { width: 100%; height: 100%; object-fit: cover; border-radius: 4px 8px 8px 4px; box-shadow: 0 10px 20px rgba(42,36,51,.18); transition: transform .5s var(--ease); }
.book-card:hover .book-media > a > img { transform: translateY(-4px) rotate(-1.5deg); }
.type-dot { position: absolute; top: 10px; inset-inline-end: 10px; 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: 10px; inset-inline-start: 10px; z-index: 2; display: flex; flex-direction: column; gap: 5px; align-items: flex-start; }
.badge { display: inline-block; padding: 1px 10px; border-radius: var(--pill); font-size: 12px; font-weight: 800; line-height: 1.8; }
.badge-sale { background: var(--store-accent); color: var(--white); }
.badge-new { background: var(--store-primary); color: var(--white); }
.stock-out { position: absolute; inset-inline: 12px; bottom: 12px; z-index: 2; border-radius: var(--pill); background: rgba(42,36,51,.88); color: var(--white); text-align: center; font-size: 13px; font-weight: 800; padding: 5px 0; }
.book-card.is-out .book-media > a > img { filter: grayscale(.7); opacity: .7; }
.card-tools { position: absolute; top: 48px; inset-inline-end: 10px; 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 { position: relative; width: 34px; height: 34px; 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::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; }
.tool-btn:hover { background: var(--store-primary); color: var(--white); }
.wish-btn.is-active { color: var(--store-accent); background: var(--white); }
.wish-btn.is-active svg { fill: currentColor; }
.book-body { display: flex; flex-direction: column; gap: 2px; padding-top: 12px; flex: 1; }
.book-author { font-size: 12.5px; color: var(--muted); }
.book-author:hover { color: var(--store-primary); }
.book-title { font-size: 15.5px; font-weight: 800; 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; }
.book-desc { display: none; font-size: 14px; color: var(--muted); margin-top: 6px; }
.book-card .card-cart { margin-top: auto; padding-top: 10px; }
.book-card .card-cart .btn { width: 100%; }
body[data-card-style="framed"] .book-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
body[data-card-style="minimal"] .book-media { background: transparent; }
body[data-card-style="minimal"] .book-card .card-cart .btn-primary { background: transparent; color: var(--store-primary); border-color: var(--store-primary); }
body[data-card-style="minimal"] .book-card .card-cart .btn-primary:hover { background: var(--store-primary); color: var(--white); }

/* عرض القائمة */
.books-grid.is-list { grid-template-columns: 1fr !important; gap: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.books-grid.is-list .book-card { flex-direction: row; gap: 22px; padding: 18px; border-bottom: 1px solid var(--line); }
.books-grid.is-list .book-card:last-child { border-bottom: 0; }
.books-grid.is-list .book-media { width: 190px; flex-shrink: 0; }
.books-grid.is-list .book-body { padding-top: 6px; }
.books-grid.is-list .book-title { font-size: 18px; }
.books-grid.is-list .book-desc { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.books-grid.is-list .card-cart { margin-top: 12px; padding-top: 0; }
.books-grid.is-list .card-cart .btn { width: auto; }
.books-grid.is-list .book-desc { margin-top: 8px; }

/* ---------- ترقيم الصفحات ---------- */
.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: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; background: var(--tint); transition: background .2s, color .2s; }
.pagination a:hover { background: var(--tint-2); color: var(--store-primary); }
.pagination .is-current { background: var(--store-primary); color: var(--white); }
.pagination .gap { background: transparent; min-width: 18px; color: var(--muted); }

/* ---------- الاشتراك ---------- */
.newsletter { padding-block: 10px 50px; }
.newsletter .container > * { position: relative; }
.newsletter .container { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; background: var(--store-primary-dark); color: var(--on-dark); border-radius: var(--radius); padding: 34px 40px; max-width: calc(var(--container) - 2 * var(--gutter)); background-image: radial-gradient(circle, rgba(255,255,255,.07) 2px, transparent 2.5px); background-size: 26px 26px; }
.newsletter-text { display: flex; align-items: center; gap: 18px; }
.newsletter-icon { width: 60px; height: 60px; border-radius: 50%; background: var(--store-accent); color: var(--white); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.newsletter h2 { font-size: 24px; }
.newsletter p { font-size: 14px; color: var(--on-dark-muted); }
.newsletter-form { display: flex; flex: 1; max-width: 480px; min-width: 280px; height: 54px; padding: 5px; background: var(--white); border-radius: var(--pill); }
.newsletter-form input { flex: 1; min-width: 0; border: 0; padding: 0 16px; outline: none; color: var(--store-text); background: transparent; }

/* ---------- التذييل ---------- */
.site-footer { background: var(--tint); color: var(--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(--store-primary); }
.footer-brand p { margin-top: 16px; max-width: 330px; }
.social { display: flex; gap: 8px; margin-top: 16px; }
.social a { width: 38px; height: 38px; border-radius: 50%; background: var(--white); color: var(--store-primary); display: inline-flex; align-items: center; justify-content: center; transition: background .2s, color .2s; }
.social a:hover { background: var(--store-accent); color: var(--white); }
.footer-col h4 { font-size: 17px; color: var(--store-primary); 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-primary); margin-top: 3px; }
.footer-bottom { background: var(--store-primary); color: var(--on-dark); }
.footer-bottom .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 54px; font-size: 13px; flex-wrap: wrap; }

/* ---------- صفحة المكوّنات ---------- */
.kit-hero { background: var(--tint); padding-block: 36px; }
.kit-hero h1 { font-size: 28px; color: var(--store-primary); }
.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(--tint); 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: 22px; }
.hero-box { position: relative; overflow: hidden; border-radius: var(--radius); background: var(--tint); }
.hero-track { position: relative; aspect-ratio: 1320 / 560; min-height: 360px; }
.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: 520px; padding-inline: 60px; }
.hero-tag { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 13px; color: var(--store-primary); }
.hero-tag::before { content: ""; width: 30px; height: 2px; background: currentColor; }
.hero-title { font-size: clamp(30px, 3.8vw, 52px); line-height: 1.15; margin-top: 12px; color: var(--store-primary-dark); }
.hero-text { margin-top: 14px; color: var(--muted); font-size: 16.5px; }
.hero-caption .btn { margin-top: 24px; }
.hero-dots { position: absolute; bottom: 22px; inset-inline-start: 60px; z-index: 2; display: flex; gap: 8px; }
.hero-dots[hidden] { display: none; }
.hero-dots button { width: 10px; height: 10px; border-radius: 5px; background: var(--line-strong); transition: width .3s, background .3s; }
.hero-dots button[aria-current="true"] { width: 28px; background: var(--store-primary); }

/* ---------- التصنيفات والمؤلّفون في دوائر ---------- */
.cat-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 20px; }
.cat-circle, .author-circle { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.ring { position: relative; display: block; width: 100%; max-width: 168px; aspect-ratio: 1; padding: 8px; border-radius: 50%; border: 2px dashed var(--line-strong); transition: border-color .3s, transform .4s var(--ease); }
.ring img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.cat-circle:hover .ring, .author-circle:hover .ring { border-color: var(--store-accent); transform: rotate(-6deg); }
.cat-circle:hover .ring img, .author-circle:hover .ring img { transform: rotate(6deg); }
.ring img { transition: transform .4s var(--ease); }
.cat-circle b, .author-circle b { font-size: 15px; color: var(--store-primary); }
.author-circle small { font-size: 12.5px; color: var(--muted); margin-top: -8px; }
.authors-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 20px; }
.authors-row .ring { max-width: 150px; }

/* ---------- المختارات ---------- */
.featured { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; align-items: stretch; }
.featured > div { min-width: 0; }
.featured-banner { position: relative; display: flex; align-items: flex-end; min-height: 520px; border-radius: var(--radius); overflow: hidden; }
.featured-banner > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .7s var(--ease); }
.featured-banner:hover > img { transform: scale(1.04); }
.featured-banner::after { content: ""; position: absolute; inset: 52% 0 0; background: linear-gradient(to top, rgba(59,47,120,.94) 30%, rgba(59,47,120,0)); }
.featured-body { position: relative; z-index: 1; padding: 34px; color: var(--white); }
.featured-body h3 { font-size: clamp(26px, 3vw, 38px); margin: 4px 0 14px; }
.promo-tag { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 800; }
.promo-tag::before { content: ""; width: 24px; height: 2px; background: currentColor; }
.books-grid.is-2x2 { --per-row: 2 !important; }

/* ---------- شريط الثقة ---------- */
.trust { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--tint); border-radius: var(--radius); }
.trust-item { display: flex; align-items: center; gap: 14px; padding: 18px 24px; }
.trust-icon { color: var(--store-accent); }
.trust-item h3 { font-size: 15.5px; }
.trust-item p { font-size: 13px; color: var(--muted); }

/* ---------- البانران ---------- */
.banner-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.promo { position: relative; overflow: hidden; display: flex; min-height: 260px; border-radius: var(--radius); background: var(--store-primary-dark); color: var(--white); }
.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: 30px 34px; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; max-width: 55%; }
.promo-title { font-size: clamp(22px, 2.4vw, 32px); margin: 6px 0 16px; }

/* ---------- الرفّ: التصنيفات وقائمة الكتب ---------- */
.shelf { display: grid; grid-template-columns: 300px 1fr; gap: 28px; align-items: start; }
.shelf > * { min-width: 0; }
.side-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 8px; }
.side-cats li + li { margin-top: 2px; }
.side-cats a { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: var(--radius-sm); font-size: 14.5px; font-weight: 500; transition: background .2s, color .2s; }
.side-cats a:hover, .side-cats a[aria-current="true"] { background: var(--tint); color: var(--store-primary); }
.side-cats img { width: 32px; height: 32px; border-radius: 50%; }
.side-cats .num { margin-inline-start: auto; }
.num { font-size: 12px; color: var(--muted); background: var(--tint); padding: 0 8px; border-radius: 10px; font-weight: 500; }
.shelf-main .books-grid.is-list .book-media { width: 170px; }

/* ---------- البانر العريض ---------- */
.wide-banner { position: relative; display: flex; justify-content: flex-start; min-height: 300px; border-radius: var(--radius); overflow: hidden; background: var(--store-primary); color: var(--white); }
.wide-banner > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: left center; }
.wide-body { position: relative; z-index: 1; padding: 40px 50px; max-width: 560px; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; }
.wide-body h3 { font-size: clamp(26px, 3vw, 40px); margin-top: 6px; }
.wide-body p { color: var(--on-dark-muted); margin: 8px 0 20px; }
/* عدّاد العرض (offer.ends_at): يرسمه theme.js، ويُخفى إن غاب التاريخ أو انقضى */
.countdown { display: flex; gap: 8px; margin: -6px 0 20px; }
.countdown[hidden] { display: none; }
.countdown span { display: grid; justify-items: center; min-width: 58px; padding: 7px 4px 6px; border-radius: var(--radius-sm); background: var(--white); color: var(--store-primary-dark); line-height: 1.1; box-shadow: 0 6px 16px rgba(0,0,0,.12); }
.countdown b { font-size: 22px; font-weight: 800; color: var(--store-accent); font-variant-numeric: tabular-nums; }
.countdown small { font-size: 11.5px; font-weight: 700; color: var(--muted); margin-top: 2px; }

/* ---------- الآراء ---------- */
.reviews-section { background: var(--tint); margin-bottom: 44px; }
.reviews-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.review-card { background: var(--white); border-radius: var(--radius); padding: 26px; display: flex; flex-direction: column; gap: 12px; margin: 0; box-shadow: 0 4px 16px rgba(59,47,120,.05); }
.review-card .quote { color: var(--store-accent); }
.review-card blockquote { margin: 0; flex: 1; }
.review-person { display: flex; align-items: center; gap: 12px; padding-top: 12px; border-top: 1px dashed var(--line-strong); }
.review-avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--tint-2); 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); }

/* ---------- رأس الصفحات الداخليّة ---------- */
.page-hero { background: var(--tint); background-image: radial-gradient(circle, var(--tint-2) 2px, transparent 2.5px); background-size: 28px 28px; }
.page-hero .container { display: flex; align-items: center; gap: 22px; min-height: 170px; padding-block: 24px; }
.page-hero h1 { font-size: 34px; color: var(--store-primary); }
.page-hero.is-small .container { min-height: 120px; }
.page-hero-img { width: 110px; height: 110px; padding: 6px; border-radius: 50%; border: 2px dashed var(--line-strong); background: var(--white); }
.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: 18px 0; }
.tab-panel[hidden] { display: none; }

/* ---------- التصنيف ---------- */
.shop-layout { display: grid; grid-template-columns: 280px 1fr; gap: 28px; padding-block: 32px 56px; align-items: start; }
.shop-layout > * { min-width: 0; }
.shop-layout .books-grid { --per-row: 3; }
.filters { display: grid; gap: 16px; position: sticky; top: 150px; }
.filters-toggle { display: none; }
.filters-body { display: grid; gap: 16px; }
.widget { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.widget h3 { font-size: 17px; color: var(--store-primary); margin-bottom: 12px; }
.widget .side-cats a { padding-block: 6px; }
.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 12px; border-radius: var(--pill); }
.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(--tint); border-radius: var(--pill); padding: 8px 8px 8px 8px; padding-inline-start: 22px; margin-bottom: 18px; font-size: 14px; color: var(--muted); }
.toolbar-end { display: flex; align-items: center; gap: 8px; }
.view-switch { display: flex; gap: 4px; }
.view-switch button { width: 40px; height: 40px; border-radius: 50%; background: var(--white); display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.view-switch button[aria-pressed="true"] { background: var(--store-primary); color: var(--white); }
.select { appearance: none; -webkit-appearance: none; border: 0; border-radius: var(--pill); background: var(--white); padding: 8px 16px 8px 38px; 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='%23625B6E' stroke-width='2.4'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 14px center; }
.active-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.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-accent); color: var(--store-accent); }
.chip-clear { border-style: dashed; color: var(--store-accent); }
.shop-layout .pagination { margin-top: 36px; }

/* ---------- صفحة الكتاب ---------- */
.product { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; padding-block: 20px 36px; align-items: start; }
.product > * { min-width: 0; }
.gallery { position: sticky; top: 150px; }
.gallery-main { position: relative; background: var(--cover-bg); border-radius: var(--radius); padding: 48px; }
.gallery-main img { width: 100%; max-width: 330px; margin-inline: auto; aspect-ratio: 2/3; object-fit: cover; border-radius: 4px 10px 10px 4px; box-shadow: 0 22px 44px rgba(42,36,51,.22); }
.gallery-main .type-dot { width: 42px; height: 42px; top: 16px; inset-inline-end: 16px; }
.gallery-main .type-dot svg { width: 20px; height: 20px; }
.gallery-main .badges { top: 16px; inset-inline-start: 16px; }
.gallery-thumbs { display: flex; justify-content: center; gap: 10px; margin-top: 14px; }
.gallery-thumbs button { width: 76px; border: 2px solid transparent; border-radius: var(--radius-sm); padding: 6px; background: var(--cover-bg); }
.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; border-radius: 3px; }
.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(26px, 2.8vw, 36px); line-height: 1.25; margin-top: 10px; color: var(--store-primary-dark); }
.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; }
.price-box { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 18px; }
.price-box .price-now { font-size: 32px; }
.price-box .price-old { font-size: 17px; }
.save-tag { padding: 2px 12px; border-radius: var(--pill); background: var(--tint-2); color: var(--store-primary-dark); font-size: 13px; font-weight: 800; }
.product-excerpt { margin-top: 14px; color: var(--muted); }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.fact { background: var(--tint); border-radius: var(--radius-sm); padding: 10px 14px; }
.fact > span { display: block; font-size: 12px; color: var(--muted); }
.fact b { font-size: 14px; }
.stock-line { display: inline-flex; align-items: center; gap: 8px; margin-top: 18px; font-size: 14px; font-weight: 800; color: #2B6B4E; }
.stock-line::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.buy-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.buy-row .btn { flex: 1; min-width: 160px; min-height: 52px; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: var(--pill); height: 52px; background: var(--white); padding-inline: 4px; }
.qty button { width: 40px; height: 100%; display: inline-flex; align-items: center; justify-content: center; color: var(--store-primary); }
.qty input { width: 40px; 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: 52px; height: 52px; border: 1px solid var(--line-strong); border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--store-accent); }
.wish-inline:hover, .wish-inline.is-active { border-color: var(--store-accent); }
.wish-inline.is-active svg { fill: currentColor; }
.tabs { margin-block: 10px 8px; }
.tab-list { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.tab-list button { padding: 10px 24px; border-radius: var(--pill); font-weight: 800; color: var(--muted); background: var(--tint); transition: background .2s, color .2s; }
.tab-list button[aria-selected="true"] { background: var(--store-primary); color: var(--white); }
.tabs .tab-panel { margin-top: 18px; padding: 28px 32px; border: 1px solid var(--line); border-radius: var(--radius); }
.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-bottom: 1px solid var(--line); }
.spec-table th { width: 30%; color: var(--muted); 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: 44px; line-height: 1; color: var(--store-primary); }
.review-summary p { font-size: 13px; color: var(--muted); }
.review-item { display: grid; grid-template-columns: 44px 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); }

/* ---------- صفحة المؤلّف ---------- */
.author-hero { position: relative; overflow: hidden; background: var(--tint); }
.author-hero-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.author-hero .container { position: relative; display: flex; align-items: center; gap: 28px; padding-block: 40px; }
.ring-lg { width: 190px; max-width: 190px; flex-shrink: 0; background: var(--white); }
.author-hero-text h1 { font-size: 36px; color: var(--store-primary); margin-top: 6px; }
.author-lines { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 8px; font-size: 14px; color: var(--muted); }
.author-lines > span { display: inline-flex; align-items: center; gap: 6px; }
.author-lines svg.icon { color: var(--store-accent); }
.author-layout { display: grid; grid-template-columns: 300px 1fr; gap: 28px; padding-block: 32px 56px; align-items: start; }
.author-layout > * { min-width: 0; }
.author-layout .books-grid { --per-row: 4; }
.about-panel { border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; line-height: 1.95; position: sticky; top: 150px; }
.about-panel h2 { font-size: 19px; color: var(--store-primary); margin-bottom: 8px; }
.about-panel p + p { margin-top: 10px; }

/* ---------- السلّة ---------- */
.cart-layout { display: grid; grid-template-columns: 1fr 360px; gap: 26px; padding-block: 30px 56px; align-items: start; }
.cart-layout > * { min-width: 0; }
.cart-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.free-ship { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; padding: 14px 18px; border-radius: var(--radius-sm); background: var(--tint); font-size: 14px; }
.free-ship > svg { color: var(--store-accent); }
.free-ship > div { flex: 1; }
.free-ship b { color: var(--store-primary); }
.free-ship i { display: block; height: 8px; margin-top: 8px; background: var(--white); border-radius: 4px; overflow: hidden; }
.free-ship i::before { content: ""; display: block; height: 100%; width: var(--w, 0%); border-radius: 4px; background: linear-gradient(to left, var(--store-primary), var(--store-accent)); }
.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: 70px; aspect-ratio: 2/3; object-fit: cover; border-radius: 3px 6px 6px 3px; flex-shrink: 0; box-shadow: 0 6px 14px rgba(42,36,51,.15); }
.cart-product h3 { font-size: 15px; margin-top: 2px; }
.cart-product h3 a:hover { color: var(--store-primary); }
.digital-note { font-size: 13px; color: var(--muted); }
.cart-table .qty { height: 42px; }
.cart-table .qty button { width: 32px; }
.cart-table .qty input { width: 34px; }
.remove-btn { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.remove-btn:hover { background: #FBEAEF; color: #A3214F; }
.cart-foot { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-top: 16px; }
.cart-foot-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }
.coupon { display: flex; height: 46px; padding: 3px; border: 1px solid var(--line-strong); border-radius: var(--pill); }
.coupon input { border: 0; padding: 0 14px; min-width: 0; width: 100%; outline: none; background: transparent; }
.coupon .btn { min-height: 100%; padding-inline: 18px; }
.applied-coupon { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.summary { background: var(--tint); border-radius: var(--radius); padding: 24px; position: sticky; top: 150px; }
.summary h2 { font-size: 19px; color: var(--store-primary); padding-bottom: 12px; margin-bottom: 4px; border-bottom: 1px dashed var(--line-strong); }
.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 dashed var(--line-strong); 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: 50px 10px; text-align: center; }
.notfound-art { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--store-primary); }
.notfound-art span { font-size: clamp(90px, 14vw, 160px); font-weight: 800; line-height: 1; }
.notfound-art svg { width: clamp(100px, 14vw, 160px); height: auto; }
.notfound h1 { font-size: 28px; margin-top: 18px; color: var(--store-primary-dark); }
.notfound p { color: var(--muted); max-width: 520px; margin: 8px auto 0; }
.notfound .search-bar { margin: 26px auto 0; border: 2px solid var(--store-primary); max-width: 560px; }
.notfound-links { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

/* ============================================================
   الاستجابة
   ============================================================ */
/* ---------- المقالات (latest_posts، post.*) ---------- */
.posts-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 26px 22px; }
.post-card { display: flex; flex-direction: column; background: var(--white); border: 2px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: border-color .25s var(--ease), box-shadow .25s var(--ease), transform .25s var(--ease); }
.post-card:hover { border-color: var(--tint-2); box-shadow: var(--shadow); transform: translateY(-3px); }
.post-media { display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--cover-bg); }
.post-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.post-card:hover .post-media img { transform: scale(1.04); }
.post-body { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px 18px; flex: 1; }
.post-meta { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.post-meta .icon { color: var(--store-accent); }
.post-title { font-size: 18px; line-height: 1.45; color: var(--store-primary-dark); }
.post-title a:hover { color: var(--store-primary); }
.post-excerpt { font-size: 14.5px; color: var(--muted); }
.post-body .link-more { margin-top: auto; padding-top: 6px; }
.icon-flip { transform: scaleX(-1); }
.blog-intro { margin-bottom: 22px; color: var(--muted); }
.post-page-title { margin-top: 8px; font-size: 32px; line-height: 1.35; }
.page-hero .post-meta { margin-top: 6px; }
.article { max-width: 820px; margin-inline: auto; }
.article-image { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius); }
.article-body { margin-top: 26px; font-size: 17px; line-height: 1.95; }
.article-body p + p { margin-top: 16px; }
.article-back { margin-top: 24px; }

@media (max-width: 1199px) {
  .header-help span { display: none; }
  .header-help { margin-inline-end: 0; }
  .books-grid { --per-row: 4 !important; }
  .books-grid.is-2x2 { --per-row: 2 !important; }
  .shop-layout { grid-template-columns: 250px 1fr; }
  .shop-layout .books-grid, .author-layout .books-grid { --per-row: 3 !important; }
  .authors-row { grid-template-columns: repeat(3, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .help-btn { display: none; }
}

@media (max-width: 991px) {
  /* الهاتف واللوح: القائمة والشعار يمينًا، والسلّة يسارًا، والبحث تحتها */
  .header-main .container { display: grid; grid-template-columns: auto 1fr auto; min-height: 66px; gap: 8px; }
  .menu-toggle { 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; border-radius: 12px; }
  .brand-name { font-size: 19px; }
  .header-actions { display: contents; }
  .header-help, .header-wish { display: none; }
  .header-cart { grid-column: 3; grid-row: 1; justify-self: end; }
  .search-bar { grid-column: 1 / -1; grid-row: 2; max-width: none; width: 100%; margin-bottom: 12px; height: 46px; }
  .search-cat { display: none; }
  .cat-strip { display: none; }
  .hero-track { aspect-ratio: auto; height: 400px; }
  .cat-row { grid-template-columns: repeat(3, 1fr); }
  .featured { grid-template-columns: 1fr; }
  .featured-banner { min-height: 380px; }
  .trust { grid-template-columns: 1fr 1fr; }
  .books-grid { --per-row: 3 !important; }
  .banner-pair { grid-template-columns: 1fr; }
  .shelf { grid-template-columns: 1fr; }
  .shelf-side .side-cats { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
  .shelf-side .side-cats li + li { margin-top: 0; }
  .reviews-grid { grid-template-columns: 1fr; }
  .shop-layout, .author-layout { grid-template-columns: 1fr; }
  .filters, .about-panel { position: static; }
  .filters-toggle { display: inline-flex; }
  .filters-body { display: none; grid-template-columns: 1fr 1fr; }
  .filters.is-open .filters-body { display: grid; }
  .product { grid-template-columns: 1fr; gap: 24px; }
  .gallery { position: static; }
  .cart-layout { grid-template-columns: 1fr; }
  .summary { position: static; }
}

@media (max-width: 991px) {
  .posts-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .posts-grid:not(.posts-grid--blog) > :nth-child(3) { display: none; }
}
@media (hover: none) {
  .card-tools { opacity: 1; transform: none; }
}

@media (max-width: 767px) {
  body { padding-bottom: 62px; }
  .topbar { font-size: 12px; }
  .section { padding-block: 32px; }
  .section-title { font-size: 22px; }
  .section-head.is-start .section-title { font-size: 20px; }
  .section-sub { font-size: 13.5px; }
  .hero { padding-top: 14px; }
  .hero-track { height: 440px; }
  .hero-slide > img { object-position: 10% center; }
  .hero-caption { justify-content: flex-end; padding: 0 20px 56px; max-width: none; }
  .hero-caption::before { content: ""; position: absolute; inset: 20% 0 0; z-index: -1; background: linear-gradient(to top, var(--tint) 62%, transparent); }
  .hero-text { font-size: 14.5px; }
  .hero-caption .btn { width: 100%; }
  .hero-dots { inset-inline-start: 20px; }
  .cat-row { grid-template-columns: repeat(3, 1fr); gap: 14px 10px; }
  .cat-circle b, .author-circle b { font-size: 13px; }
  .ring { padding: 5px; }
  .featured-banner { min-height: 320px; }
  .featured-body { padding: 24px; }
  .trust-item { flex-direction: column; text-align: center; gap: 6px; padding: 18px 8px; }
  .trust-item h3 { font-size: 14px; }
  .trust-item p { font-size: 12px; }
  .books-grid { --per-row: 2 !important; gap: 20px 12px; }
  .book-title { font-size: 14px; }
  .price-now { font-size: 15.5px; }
  .book-card .card-cart .btn { min-height: 40px; font-size: 13px; padding-inline: 8px; }
  .type-dot { width: 28px; height: 28px; top: 8px; inset-inline-end: 8px; }
  .type-dot svg { width: 14px; height: 14px; }
  .card-tools { top: 42px; inset-inline-end: 8px; }
  .tool-btn { width: 32px; height: 32px; }
  .badges { top: 8px; inset-inline-start: 8px; }
  .promo { min-height: 220px; }
  .promo-body { padding: 24px 22px; max-width: 75%; }
  .promo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to left, var(--store-primary-dark) 50%, transparent 90%); }
  .shelf-side .side-cats { grid-template-columns: 1fr; }
  .books-grid.is-list .book-card { gap: 14px; padding: 14px; }
  .books-grid.is-list .book-media, .shelf-main .books-grid.is-list .book-media { width: 110px; }
  .books-grid.is-list .book-title { font-size: 15px; }
  .books-grid.is-list .book-desc { -webkit-line-clamp: 2; font-size: 13px; }
  .authors-row { grid-template-columns: repeat(3, 1fr); gap: 14px 10px; }
  .wide-banner { min-height: 280px; }
  .wide-banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to left, var(--store-primary) 55%, transparent 95%); }
  .wide-body { padding: 28px 22px; max-width: 85%; }
  .newsletter .container { margin-inline: var(--gutter); width: auto; padding: 26px 20px; flex-direction: column; flex-wrap: nowrap; align-items: stretch; text-align: center; }
  .newsletter-text { flex-direction: column; min-width: 0; }
  .newsletter-form { min-width: 0; max-width: none; }
  .footer-grid { grid-template-columns: 1fr; gap: 26px; padding-block: 38px 26px; }
  .footer-bottom .container { justify-content: center; text-align: center; padding-block: 12px; }
  .page-hero .container { min-height: 130px; gap: 14px; }
  .page-hero h1 { font-size: 26px; }
  .page-hero-img { width: 80px; height: 80px; }
  .filters-body { grid-template-columns: 1fr; }
  .shop-layout .books-grid, .author-layout .books-grid { --per-row: 2 !important; }
  .shop-toolbar { border-radius: var(--radius); flex-direction: column; align-items: stretch; padding: 12px; }
  .toolbar-end .select { flex: 1; }
  .view-switch { display: none; }
  .shop-layout .books-grid.is-list { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; border: 0; gap: 20px 12px; }
  .shop-layout .books-grid.is-list .book-card { flex-direction: column; padding: 0; border: 0; gap: 0; }
  .shop-layout .books-grid.is-list .book-media { width: auto; }
  .shop-layout .books-grid.is-list .book-desc { display: none; }
  .gallery-main { padding: 28px; }
  .gallery-main img { max-width: 220px; }
  .buy-row .btn { min-width: 0; }
  .facts { grid-template-columns: 1fr 1fr; }
  .tabs .tab-panel { padding: 20px 16px; }
  .tab-list button { padding: 9px 16px; font-size: 14px; }
  .author-hero .container { flex-direction: column; text-align: center; gap: 14px; padding-block: 28px; }
  .ring-lg { width: 140px; }
  .author-hero-text .breadcrumb, .author-lines { justify-content: center; }
  .author-hero-text h1 { font-size: 28px; }
  .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%; }

  .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(59,47,120,.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); border-color: var(--white); }
}

@media (max-width: 767px) {
  .posts-grid, .posts-grid--blog { grid-template-columns: 1fr; }
  .posts-grid:not(.posts-grid--blog) > :nth-child(3) { display: flex; }
  .post-page-title { font-size: 24px; }
  .article-body { font-size: 16px; }
  .countdown span { min-width: 0; flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* إن أخفى الناشر إحدى منطقتَي القسم، تمتدّ الأخرى على عرضه */
.featured > :only-child, .shelf > :only-child { grid-column: 1 / -1; }
.featured > div:only-child .books-grid.is-2x2 { --per-row: 4 !important; }
@media (max-width: 767px) { .featured > div:only-child .books-grid.is-2x2 { --per-row: 2 !important; } }

/* خيارات الإظهار (الملحق، البند 3) */
body[data-show-trust-bar="false"] .trust-section,
body[data-show-trust-bar="false"] .trust,
body[data-show-reviews="false"] .reviews-section,
body[data-show-reviews="false"] [aria-controls="tab-reviews"],
body[data-show-reviews="false"] #tab-reviews,
body[data-show-newsletter="false"] .newsletter { display: none; }
/* الخيار النصّيّ delivery_note: يُخفى الشريط العلويّ إن تُرك النصّ فارغًا */
.topbar:has([data-option="delivery_note"]:empty) { display: none; }

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

/* ============================================================
   الإصدار الثاني: الأشرطة والتبويبات والدوّار و«حكاية الأسبوع»
   ============================================================ */
:root { --cream: #FFF7E6; }
.band-tint { background: var(--tint); background-image: radial-gradient(circle, var(--tint-2) 1.6px, transparent 2px); background-size: 30px 30px; }
.band-cream { background: var(--cream); }
.band-tint .side-box, .band-tint .books-grid.is-list { background: var(--white); }
.section + .section.band-tint, .section + .section.band-cream { margin-top: 0; }
.reviews-section { margin-bottom: 0; }
.reviews-section + .section { padding-top: 44px; }
/* قسمان أبيضان متتاليان: فراغٌ واحد بينهما لا فراغان */
.section:not(.band-tint):not(.band-cream):not(.reviews-section) + .section:not(.band-tint):not(.band-cream):not(.reviews-section) { padding-top: 0; }

/* المختارات: التبويبات فوق الشبكة */
.featured-books { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.row-tabs { display: flex; flex-wrap: nowrap; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.row-tabs::-webkit-scrollbar { display: none; }
.row-tab { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; min-height: 42px; padding: 4px 12px 4px 5px; border-radius: var(--pill); border: 2px dashed var(--line-strong); background: var(--white); color: var(--store-text); font-weight: 800; font-size: 13.5px; white-space: nowrap; transition: border-color .2s, background .2s, color .2s; }
.row-tab img { width: 28px; height: 28px; border-radius: 50%; }
.row-tab:hover { border-color: var(--store-accent); }
.row-tab[aria-selected="true"] { background: var(--store-primary); border: 2px solid var(--store-primary); color: var(--white); }
[data-slot="section.tabs"]:not(:has([data-repeat="tab"] ~ [role="tab"])) { display: none; }

/* الأكثر مبيعًا: قائمةٌ في عمودين */
.books-grid.is-list.is-list-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
.books-grid.is-list-2 .book-card { border-bottom: 1px solid var(--line); }
.books-grid.is-list-2 .book-card:nth-child(odd) { border-inline-end: 1px solid var(--line); }
.books-grid.is-list-2 .book-card:nth-last-child(-n+2):nth-child(odd), .books-grid.is-list-2 .book-card:last-child { border-bottom: 0; }
.shelf-main .books-grid.is-list-2 .book-media { width: 130px; }
.books-grid.is-list-2 .book-title { font-size: 16.5px; }
.books-grid.is-list-2 .book-desc { -webkit-line-clamp: 2; font-size: 13.5px; }

/* حكاية الأسبوع: كتابٌ واحد بغلافٍ كبير */
.week { position: relative; padding: 46px 56px; border-radius: calc(var(--radius) * 1.6); background: color-mix(in srgb, var(--store-accent) 4%, #FFFFFF); overflow: hidden; }
.week::before { content: ""; position: absolute; inset-block-start: -60px; inset-inline-start: -60px; width: 220px; height: 220px; border-radius: 50%; border: 2px dashed color-mix(in srgb, var(--store-accent) 30%, #FFFFFF); }
.week-kicker { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 4px 14px; border-radius: var(--pill); background: var(--store-accent); color: var(--white); font-size: 13.5px; font-weight: 800; }
.week-kicker svg { fill: currentColor; }
.week-book { position: relative; display: grid; grid-template-columns: 1fr minmax(240px, 330px); gap: 56px; align-items: center; margin-top: 18px; }
.week-media { position: relative; order: 2; padding: 26px; }
.week-ring { position: absolute; inset: 0; border-radius: 50%; border: 3px dashed var(--store-accent); background: var(--white); opacity: .9; transition: transform .6s var(--ease); }
.week-book:hover .week-ring { transform: rotate(-12deg); }
.week-cover { position: relative; display: block; width: 72%; margin-inline: auto; }
.week-cover img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 4px 10px 10px 4px; box-shadow: 0 22px 40px rgba(42,36,51,.25); transform: rotate(-4deg); transition: transform .5s var(--ease); }
.week-book:hover .week-cover img { transform: rotate(0); }
.week-media .badges { top: 18px; inset-inline-start: 18px; }
.week-media .type-dot { top: 18px; inset-inline-end: 18px; width: 40px; height: 40px; }
.week-media .type-dot svg { width: 20px; height: 20px; }
.week-body { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; min-width: 0; }
.week-title { font-size: clamp(28px, 3vw, 42px); color: var(--store-primary-dark); line-height: 1.2; }
.week-title a:hover { color: var(--store-primary); }
.week-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 18px; font-size: 14.5px; color: var(--muted); }
.week-meta a { color: var(--store-primary); font-weight: 800; }
.week-desc { max-width: 600px; color: var(--store-text); line-height: 1.9; }
.week-desc p + p { margin-top: 6px; color: var(--muted); }
.week-buy { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 14px; margin-top: 6px; }
.week-price .price-now { font-size: 28px; }
.week-buy .wish-inline { width: 46px; height: 46px; background: var(--white); }

/* وصل حديثًا: دوّارٌ أفقيّ */
.carousel-nav { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.carousel-btn { width: 40px; height: 40px; border-radius: 50%; border: 2px dashed var(--line-strong); background: var(--white); color: var(--store-primary); display: inline-flex; align-items: center; justify-content: center; transition: background .2s, color .2s, border-color .2s; }
.carousel-btn:hover:not(:disabled) { background: var(--store-primary); border: 2px solid 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) * 22px) / var(--per-row)); gap: 22px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: none; padding-bottom: 4px; }
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-track > * { scroll-snap-align: start; }
body[data-books-per-row="3"] .carousel-track { --per-row: 4; }
body[data-books-per-row="6"] .carousel-track { --per-row: 6; }
.band-cream .book-media { background: var(--white); }

@media (max-width: 1199px) {
  .carousel-track { --per-row: 4 !important; }
  .week { padding: 36px; }
  .week-book { gap: 36px; }
}
@media (max-width: 991px) {
  .carousel-track { --per-row: 3 !important; }
  .featured-banner { order: 2; }
  .books-grid.is-list.is-list-2 { grid-template-columns: 1fr !important; }
  .books-grid.is-list-2 .book-card:nth-child(odd) { border-inline-end: 0; }
  .books-grid.is-list-2 .book-card:nth-last-child(-n+2):nth-child(odd) { border-bottom: 1px solid var(--line); }
  .week-book { grid-template-columns: 1fr 260px; }
  .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; }
  .trust-item + .trust-item { border-inline-start: 1px dashed var(--line-strong); }
}
@media (max-width: 767px) {
  /* السلايدر: الصورة فوق النصّ لا خلفه */
  .hero-track { display: grid; height: auto; min-height: 0; aspect-ratio: auto; }
  .hero-slide { position: relative; grid-area: 1 / 1; display: flex; flex-direction: column; }
  .hero-slide > img { position: static; height: 190px; object-position: left center; }
  .hero-caption { justify-content: flex-start; height: auto; padding: 18px 20px 46px; }
  .hero-caption::before { content: none; }
  .hero-title { font-size: 28px; margin-top: 6px; }
  .hero-caption .btn { margin-top: 16px; }
  .hero-dots { bottom: 18px; }
  /* التصنيفات صفٌّ واحد يُمرَّر */
  .cat-row { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); }
  .cat-row::-webkit-scrollbar { display: none; }
  .cat-row > * { flex: 0 0 100px; scroll-snap-align: start; }
  .cats-section { padding-block: 20px 8px; }
  .trust-item { flex-direction: row; text-align: start; gap: 10px; padding: 12px 16px; }
  .trust-item .icon-lg { width: 24px; height: 24px; }
  .featured-banner { min-height: 260px; }
  .featured-banner > img { object-position: center 35%; }
  .featured-banner::after { inset: 28% 0 0; background: linear-gradient(to top, rgba(59,47,120,.95) 58%, rgba(59,47,120,0)); }
  .featured-body { padding: 20px 22px; }
  .featured-body h3 { margin-bottom: 10px; }
  .posts-grid:not(.posts-grid--blog) { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; gap: 12px; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); }
  .posts-grid:not(.posts-grid--blog)::-webkit-scrollbar { display: none; }
  .posts-grid:not(.posts-grid--blog) > * { flex: 0 0 84%; scroll-snap-align: center; }
  .row-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); }
  .row-tabs::-webkit-scrollbar { display: none; }
  .row-tab { flex: 0 0 auto; }
  .shelf-main .books-grid.is-list-2 .book-media { width: 104px; }
  .books-grid.is-list-2 .book-title { font-size: 15px; }
  .week { padding: 26px 18px; }
  .week-book { grid-template-columns: 1fr; gap: 18px; }
  .week-media { order: 0; width: 76%; max-width: 280px; margin-inline: auto; padding: 18px; }
  .week-title { font-size: 26px; }
  .week-buy .btn { flex: 1; }
  .carousel-track { grid-auto-columns: 44%; gap: 12px; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); scroll-padding-inline: var(--gutter); }
  .carousel-btn { display: none; }
  .reviews-grid { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; gap: 12px; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); }
  .reviews-grid::-webkit-scrollbar { display: none; }
  .review-card { flex: 0 0 84%; scroll-snap-align: center; padding: 20px; }
  .reviews-section + .section { padding-top: 32px; }
}
@media (hover: none) { .carousel-btn { display: none; } }

/* صفحة الكتاب: الصيغ والتوصيل */
.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 16px 8px 10px; border: 2px dashed var(--line-strong); border-radius: var(--pill); background: var(--white); transition: border-color .2s, background .2s; }
.format-opt .type-dot { position: static; grid-row: span 2; width: 30px; height: 30px; box-shadow: none; }
.format-opt .type-dot svg { width: 15px; height: 15px; }
.format-name { font-size: 14px; font-weight: 800; line-height: 1.3; }
.format-price { font-size: 12.5px; color: var(--muted); line-height: 1.3; }
.format-opt:hover { border-color: var(--store-accent); }
.format-opt.is-current { border: 2px solid var(--store-primary); background: var(--tint); }
[data-slot="book.formats"]:not(:has([data-repeat="format"] ~ [data-preview-copy])) { display: none; }
.info-list { display: grid; gap: 8px; margin-top: 18px; padding: 14px 18px; border: 2px dashed var(--line-strong); border-radius: var(--radius); background: var(--tint); font-size: 14px; }
.info-list li { display: flex; align-items: center; gap: 10px; }
.info-list svg { color: var(--store-accent); }
.info-list li:has(> [data-option="delivery_note"]:empty) { display: none; }
@media (max-width: 767px) {
  .format-opt { min-width: 0; flex: 1 1 30%; padding-inline: 8px 10px; column-gap: 8px; }
}

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