/* ============================================================
   مكتبة مدى — واجهة المتجر (الرئيسية · القوائم · صفحة الكتاب · الصفحات)
   يعتمد على رموز app.css فقط.
   ============================================================ */

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; background:
  radial-gradient(900px 480px at 100% -10%, rgb(43 156 214 / .18), transparent 65%),
  radial-gradient(620px 420px at -5% 105%, rgb(254 195 0 / .14), transparent 70%),
  linear-gradient(180deg, #fff 0%, var(--surface-muted) 100%);
  border-bottom: 1px solid var(--line); }
.hero::before { content: ""; position: absolute; inset: 0; opacity: .5; pointer-events: none;
  background-image: radial-gradient(rgb(43 156 214 / .18) 1px, transparent 1px); background-size: 26px 26px;
  -webkit-mask-image: linear-gradient(115deg, transparent 35%, #000 75%); mask-image: linear-gradient(115deg, transparent 35%, #000 75%); }
.hero .container { position: relative; display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr); gap: 48px; align-items: center; padding-block: 64px 72px; }
.hero h1 { font-size: clamp(2rem, 4.4vw, 3.35rem); line-height: 1.22; letter-spacing: -.01em; margin-bottom: 18px; }
.hero h1 .accent { background: linear-gradient(120deg, var(--brand-500) 10%, var(--navy-700) 90%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero h1 .underline { position: relative; white-space: nowrap; }
.hero h1 .underline::after { content: ""; position: absolute; inset-inline: -2%; bottom: .08em; height: .2em; border-radius: 99px; background: linear-gradient(90deg, rgb(254 195 0 / .75), rgb(254 195 0 / .25)); z-index: -1; }
.hero .lead { font-size: 1.12rem; color: var(--ink-700); max-width: 560px; margin-bottom: 28px; }
.hero-search { display: flex; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 8px; box-shadow: var(--shadow-card); max-width: 580px; }
.hero-search .field-wrap { flex: 1; display: flex; align-items: center; gap: 10px; padding-inline: 12px; color: var(--ink-400); }
.hero-search input { flex: 1; border: 0; outline: 0; font: inherit; font-size: 1rem; height: 48px; background: transparent; color: var(--ink-900); min-width: 0; }
.hero-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; align-items: center; }
.hero-tags span.muted { font-size: .88rem; font-weight: 700; }
.hero-tags a { font-size: .85rem; font-weight: 700; padding: 5px 12px; border-radius: 99px; background: rgb(255 255 255 / .8); border: 1px solid var(--line); color: var(--ink-700); }
.hero-tags a:hover { border-color: var(--brand-300); color: var(--brand-700); }
.hero-proof { display: flex; gap: 28px; margin-top: 34px; flex-wrap: wrap; }
.hero-proof div b { display: block; font-size: 1.6rem; font-weight: 800; color: var(--navy-800); line-height: 1.1; }
.hero-proof div span { font-size: .85rem; color: var(--ink-500); font-weight: 700; }

.hero-stage { position: relative; height: 460px; }
.hero-stage .blob { position: absolute; inset: 8% 6% 6% 4%; border-radius: 42% 58% 55% 45% / 48% 42% 58% 52%; background: linear-gradient(150deg, var(--brand-400), var(--navy-800)); box-shadow: 0 40px 80px -30px rgb(20 45 80 / .55); }
.hero-stage .blob::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: radial-gradient(circle at 30% 25%, rgb(255 255 255 / .25), transparent 55%); }
.hero-stage .ring { position: absolute; width: 150px; height: 150px; border-radius: 50%; border: 18px solid rgb(254 195 0 / .9); inset-inline-end: -10px; top: -8px; opacity: .9; }
.stack-book { position: absolute; width: 41%; aspect-ratio: 2/3; border-radius: 8px 14px 14px 8px; overflow: hidden; box-shadow: 0 2px 4px rgb(0 0 0 / .1), 0 30px 50px -18px rgb(10 25 45 / .6); background: var(--brand-200); }
.stack-book img { width: 100%; height: 100%; object-fit: cover; }
.stack-book::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgb(0 0 0 / .18), rgb(255 255 255 / .1) 3%, transparent 7%); }
.stack-book.b1 { inset-inline-start: 30%; top: 9%; z-index: 3; animation: float 7s ease-in-out infinite; }
.stack-book.b2 { inset-inline-start: 4%; top: 22%; z-index: 2; transform: rotate(8deg); width: 35%; animation: float 8s ease-in-out -2s infinite; }
.stack-book.b3 { inset-inline-start: 62%; top: 26%; z-index: 1; transform: rotate(-9deg); width: 34%; animation: float 9s ease-in-out -4s infinite; }
.float-card { position: absolute; z-index: 5; background: #fff; border-radius: 16px; padding: 12px 14px; box-shadow: var(--shadow-card); display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: .9rem; }
.float-card small { display: block; font-weight: 700; color: var(--ink-500); font-size: .75rem; }
.float-card .fc-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; }
.float-card.f1 { inset-inline-end: 0; bottom: 14%; animation: float 6s ease-in-out -1s infinite; }
.float-card.f2 { inset-inline-start: -2%; bottom: 4%; animation: float 7s ease-in-out -3s infinite; }
.float-card.f3 { inset-inline-start: 0; top: 4%; animation: float 8s ease-in-out -5s infinite; }
.wave-bars { display: inline-flex; gap: 2px; align-items: end; height: 18px; }
.wave-bars i { width: 3px; border-radius: 3px; background: var(--brand-500); animation: wave 1.1s ease-in-out infinite; }
.wave-bars i:nth-child(2) { animation-delay: -.2s } .wave-bars i:nth-child(3) { animation-delay: -.4s } .wave-bars i:nth-child(4) { animation-delay: -.6s } .wave-bars i:nth-child(5) { animation-delay: -.8s }
@keyframes wave { 0%, 100% { height: 4px } 50% { height: 18px } }
@media (max-width: 960px) {
  .hero .container { grid-template-columns: 1fr; padding-block: 40px 48px; gap: 28px; }
  .hero-stage { height: 340px; max-width: 460px; width: 100%; margin-inline: auto; }
}
@media (max-width: 520px) {
  .hero-stage { height: 280px; }
  .float-card.f3 { display: none; }
  .hero-search { flex-direction: column; }
  .hero-search .btn { width: 100%; }
  .hero-proof { gap: 18px; }
}

/* ---------- Format band ---------- */
.formats-band { margin-top: -36px; position: relative; z-index: 2; }
.formats-band .grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.format-tile { display: flex; gap: 16px; align-items: flex-start; padding: 22px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-xl); box-shadow: var(--shadow-soft); color: var(--ink-900); transition: transform .3s var(--ease), box-shadow .3s, border-color .3s; }
.format-tile:hover { color: var(--ink-900); transform: translateY(-4px); box-shadow: var(--shadow-card); border-color: var(--brand-200); }
.format-tile .ft-icon { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; flex: none; }
.format-tile .ft-icon .icon { width: 26px; height: 26px; }
.ft-ebook { background: var(--brand-50); color: var(--brand-600); }
.ft-audio { background: #fff6d6; color: #a37700; }
.ft-print { background: #e6edf7; color: var(--navy-700); }
.format-tile h3 { margin: 0 0 4px; font-size: 1.08rem; }
.format-tile p { margin: 0; color: var(--ink-500); font-size: .9rem; line-height: 1.6; }
.format-tile .go { margin-top: 8px; font-weight: 800; font-size: .85rem; color: var(--brand-600); display: inline-flex; gap: 4px; align-items: center; }
@media (max-width: 860px) { .formats-band .grid { grid-template-columns: 1fr; } .formats-band { margin-top: 24px; } }

/* ---------- Section heads with scroll buttons ---------- */
.section-head .head-actions { display: flex; gap: 8px; align-items: center; }
.row-nav { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; cursor: pointer; color: var(--ink-700); }
.row-nav:hover { border-color: var(--brand-300); color: var(--brand-700); }
.row-nav.next .icon { transform: scaleX(-1); }
.link-more { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; font-size: .92rem; white-space: nowrap; }
.link-more .icon { width: 16px; height: 16px; }
@media (max-width: 600px) { .row-nav { display: none; } .section-head { align-items: center; } }

.bg-white { background: #fff; border-block: 1px solid var(--line); }

/* ---------- Categories grid ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.cat-tile { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; min-height: 112px; padding: 18px; border-radius: var(--radius-xl); background: #fff; border: 1px solid var(--line); color: var(--ink-900); transition: transform .3s var(--ease), border-color .3s, box-shadow .3s; }
.cat-tile:hover { color: var(--ink-900); transform: translateY(-3px); border-color: var(--brand-200); box-shadow: var(--shadow-soft); }
.cat-tile b { font-size: 1.02rem; position: relative; z-index: 1; }
.cat-tile span { font-size: .82rem; color: var(--ink-500); font-weight: 700; position: relative; z-index: 1; }
.cat-tile::after { content: ""; position: absolute; width: 120px; height: 120px; border-radius: 50%; inset-inline-end: -40px; bottom: -50px; background: var(--tone, var(--brand-50)); transition: transform .4s var(--ease); }
.cat-tile:hover::after { transform: scale(1.25); }
.cat-tile:nth-child(6n+1) { --tone: var(--brand-50); } .cat-tile:nth-child(6n+2) { --tone: #fff6d6; }
.cat-tile:nth-child(6n+3) { --tone: #e6edf7; } .cat-tile:nth-child(6n+4) { --tone: var(--success-50); }
.cat-tile:nth-child(6n+5) { --tone: #fdecef; } .cat-tile:nth-child(6n+6) { --tone: #f1ecfd; }

/* ---------- Audio spotlight ---------- */
.audio-spot { position: relative; overflow: hidden; border-radius: var(--radius-2xl); background: linear-gradient(135deg, var(--navy-900), var(--navy-700) 60%, var(--brand-700)); color: #dbe7f1; padding: 40px; display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 36px; align-items: center; }
.audio-spot::before { content: ""; position: absolute; inset: 0; background: radial-gradient(520px 260px at 0% 0%, rgb(254 195 0 / .18), transparent 70%); pointer-events: none; }
.audio-spot > * { position: relative; }
.audio-spot h2 { color: #fff; }
.audio-spot .eyebrow { color: var(--gold-400); }
.audio-spot p { color: #b9cde0; }
.audio-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.audio-item { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 16px; background: rgb(255 255 255 / .06); border: 1px solid rgb(255 255 255 / .08); color: #fff; transition: background .2s; }
.audio-item:hover { background: rgb(255 255 255 / .12); color: #fff; }
.audio-item img, .audio-item .ph { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; flex: none; background: var(--brand-600); }
.audio-item b { display: block; font-size: .92rem; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.audio-item small { color: #9fb5c9; font-weight: 600; }
.audio-item .play { margin-inline-start: auto; width: 34px; height: 34px; border-radius: 50%; background: var(--gold-500); color: var(--navy-900); display: grid; place-items: center; flex: none; }
.audio-item .play .icon { width: 14px; height: 14px; fill: currentColor; stroke: none; }
@media (max-width: 960px) { .audio-spot { grid-template-columns: 1fr; padding: 28px; } }
@media (max-width: 560px) { .audio-list { grid-template-columns: 1fr; } }

/* ---------- Author CTA ---------- */
.author-cta { position: relative; overflow: hidden; border-radius: var(--radius-2xl); padding: 48px; background: linear-gradient(120deg, #fff 0%, var(--brand-50) 100%); border: 1px solid var(--brand-100); display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 36px; align-items: center; }
.author-cta h2 { font-size: clamp(1.5rem, 2.8vw, 2.15rem); }
.steps-mini { display: grid; gap: 14px; margin: 22px 0 26px; }
.steps-mini div { display: flex; gap: 12px; align-items: flex-start; }
.steps-mini .n { width: 32px; height: 32px; border-radius: 10px; background: var(--navy-800); color: var(--gold-400); display: grid; place-items: center; font-weight: 800; flex: none; }
.steps-mini b { display: block; }
.steps-mini span { color: var(--ink-500); font-size: .9rem; }
.royalty-card { background: var(--navy-900); color: #fff; border-radius: var(--radius-2xl); padding: 30px; position: relative; overflow: hidden; box-shadow: var(--shadow-card); }
.royalty-card::after { content: ""; position: absolute; width: 220px; height: 220px; border-radius: 50%; border: 26px solid rgb(254 195 0 / .18); inset-inline-end: -70px; top: -70px; }
.royalty-card .big { font-size: 4rem; font-weight: 800; line-height: 1; color: var(--gold-400); }
.royalty-card p { color: #b9cde0; margin: 8px 0 18px; }
.royalty-card ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.royalty-card li { display: flex; gap: 10px; align-items: center; font-weight: 700; font-size: .93rem; }
.royalty-card li .icon { color: var(--gold-400); width: 18px; height: 18px; }
@media (max-width: 900px) { .author-cta { grid-template-columns: 1fr; padding: 28px; } }

/* ---------- Trust points ---------- */
.trust { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.trust > div { display: flex; gap: 14px; align-items: flex-start; }
.trust .t-icon { width: 46px; height: 46px; border-radius: 14px; background: var(--brand-50); color: var(--brand-600); display: grid; place-items: center; flex: none; }
.trust b { display: block; margin-bottom: 2px; }
.trust span { color: var(--ink-500); font-size: .88rem; line-height: 1.6; display: block; }
@media (max-width: 900px) { .trust { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .trust { grid-template-columns: 1fr; } }

/* ---------- Listing page ---------- */
.list-head { padding: 34px 0 26px; background: linear-gradient(180deg, #fff, var(--surface-muted)); border-bottom: 1px solid var(--line); }
.list-head h1 { margin-bottom: 6px; }
.list-head p { color: var(--ink-500); margin: 0; max-width: 700px; }
.list-toolbar { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 24px 0 8px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips-scroll { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.chips-scroll .chip { flex: none; }
.list-search { position: relative; flex: 1; max-width: 360px; min-width: 220px; }
.list-search input { padding-inline-start: 42px !important; }
.list-search .icon { position: absolute; inset-inline-start: 14px; top: 13px; color: var(--ink-400); }
.sort-select { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink-500); font-size: .9rem; }
.sort-select select { min-height: 42px; border-radius: 12px; border: 1px solid var(--line); padding: 0 12px; font: inherit; font-weight: 700; color: var(--ink-900); background: #fff; }
.result-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--ink-500); font-weight: 700; font-size: .92rem; margin: 6px 0 22px; }
.result-line .clear { color: var(--danger-600); font-size: .85rem; }
.filter-label { font-size: .8rem; font-weight: 800; color: var(--ink-400); margin-inline-end: 4px; white-space: nowrap; }

/* ---------- Book detail ---------- */
.preview-bar { background: var(--warning-50); border-bottom: 1px solid #fde7b0; color: var(--warning-700); font-weight: 700; padding: 10px 0; font-size: .9rem; }
.book-hero { background: linear-gradient(180deg, #fff 0%, var(--surface-muted) 100%); border-bottom: 1px solid var(--line); position: relative; overflow: hidden; }
.book-hero .backdrop { position: absolute; inset: -40px; background-size: cover; background-position: center; filter: blur(60px) saturate(1.3); opacity: .18; pointer-events: none; }
.book-hero .container { position: relative; padding-block: 26px 44px; }
.book-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr) 360px; gap: 40px; align-items: start; }
.book-cover-lg { position: sticky; top: calc(var(--header-h) + 20px); }
.book-cover-lg .book-cover { border-radius: 10px 18px 18px 10px; box-shadow: 0 2px 6px rgb(0 0 0 / .1), 0 40px 60px -24px rgb(20 45 80 / .55); }
.book-cover-lg .book-cover:hover { transform: none; }
.book-cover-lg .actions { display: grid; gap: 8px; margin-top: 18px; }
.book-info h1 { font-size: clamp(1.6rem, 3vw, 2.3rem); margin-bottom: 4px; }
.book-info .subtitle { font-size: 1.12rem; color: var(--ink-500); font-weight: 600; margin-bottom: 14px; }
.byline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; color: var(--ink-500); font-weight: 600; }
.byline a.author-link { font-weight: 800; color: var(--brand-700); }
.byline .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--ink-300); }
.rating-inline { display: inline-flex; align-items: center; gap: 6px; }
.star-row { display: inline-flex; gap: 1px; }
.star-row .icon { width: 17px; height: 17px; stroke: var(--gold-500); fill: none; }
.star-row .full { fill: var(--gold-500); }
.star-row .half { fill: url(#half-star); }
.meta-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 22px 0; }
.meta-grid div { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; }
.meta-grid span { display: block; font-size: .76rem; color: var(--ink-400); font-weight: 700; }
.meta-grid b { font-size: .95rem; }
.prose { color: var(--ink-700); font-size: 1.02rem; line-height: 1.95; }
.prose p { margin-bottom: 1.1em; }
.prose h2 { margin-top: 1.6em; font-size: 1.3rem; }
.prose h3 { margin-top: 1.4em; }
.prose ul, .prose ol { padding-inline-start: 1.3em; }
.prose li { margin-bottom: .4em; }
.desc-clamp { max-height: 300px; overflow: hidden; position: relative; }
.desc-clamp::after { content: ""; position: absolute; inset-inline: 0; bottom: 0; height: 90px; background: linear-gradient(180deg, transparent, var(--surface-muted)); }
.desc-clamp.is-open { max-height: none; }
.desc-clamp.is-open::after { display: none; }
.btn-link { background: none; border: 0; padding: 0; font: inherit; font-weight: 800; color: var(--brand-600); cursor: pointer; }
.cat-links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

.buy-box { position: sticky; top: calc(var(--header-h) + 20px); padding: 22px; border-radius: var(--radius-2xl); background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow-card); }
.buy-box h2 { font-size: 1.05rem; margin-bottom: 14px; }
.fmt-options { display: grid; gap: 10px; }
.fmt-opt { position: relative; display: flex; align-items: center; gap: 12px; padding: 14px; border: 1.5px solid var(--line); border-radius: 16px; cursor: pointer; transition: border-color .2s, background .2s, box-shadow .2s; }
.fmt-opt:hover { border-color: var(--brand-200); }
.fmt-opt input { position: absolute; opacity: 0; pointer-events: none; }
.fmt-opt .fo-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-sunken); color: var(--ink-500); flex: none; transition: all .2s; }
.fmt-opt .fo-text { flex: 1; min-width: 0; }
.fmt-opt .fo-text b { display: block; font-size: .98rem; }
.fmt-opt .fo-text small { color: var(--ink-500); font-weight: 600; font-size: .8rem; }
.fmt-opt .fo-price { font-weight: 800; font-size: 1.1rem; color: var(--navy-800); white-space: nowrap; }
.fmt-opt .fo-price small { font-size: .72rem; color: var(--ink-500); }
.fmt-opt:has(input:checked) { border-color: var(--brand-500); background: var(--brand-50); box-shadow: 0 0 0 4px rgb(43 156 214 / .12); }
.fmt-opt:has(input:checked) .fo-icon { background: var(--brand-500); color: #fff; }
.fmt-opt:has(input:focus-visible) { outline: 3px solid var(--brand-300); outline-offset: 2px; }
.fmt-opt.is-owned { cursor: default; background: var(--success-50); border-color: #bdeed8; }
.fmt-opt.is-owned .fo-icon { background: var(--success-500); color: #fff; }
.qty { display: none; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding: 10px 12px; background: var(--surface-muted); border-radius: 14px; font-weight: 700; font-size: .9rem; }
.buy-box:has(input[value=print]:checked) .qty { display: flex; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; background: #fff; overflow: hidden; }
.stepper button { width: 36px; height: 36px; border: 0; background: none; cursor: pointer; color: var(--ink-700); display: grid; place-items: center; }
.stepper button:hover { background: var(--brand-50); color: var(--brand-700); }
.stepper input { width: 44px; height: 36px; border: 0; text-align: center; font: inherit; font-weight: 800; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.buy-box .btn-lg { margin-top: 16px; }
.buy-perks { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 8px; font-size: .85rem; color: var(--ink-500); font-weight: 600; }
.buy-perks li { display: flex; gap: 8px; align-items: center; }
.buy-perks .icon { width: 16px; height: 16px; color: var(--success-600); }
.owned-actions { display: grid; gap: 8px; margin-bottom: 14px; }

.tracks { list-style: none; padding: 0; margin: 0; counter-reset: t; }
.tracks li { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); counter-increment: t; }
.tracks li:last-child { border-bottom: 0; }
.tracks li::before { content: counter(t); width: 30px; height: 30px; border-radius: 10px; background: var(--brand-50); color: var(--brand-700); font-weight: 800; display: grid; place-items: center; font-size: .85rem; flex: none; }
.tracks li b { flex: 1; font-weight: 700; }
.tracks li .num { color: var(--ink-500); font-size: .85rem; }

.author-box { display: flex; gap: 18px; align-items: flex-start; }
.avatar { width: 72px; height: 72px; border-radius: 22px; object-fit: cover; flex: none; background: linear-gradient(140deg, var(--brand-400), var(--navy-700)); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 1.6rem; }
.avatar-xl { width: 132px; height: 132px; border-radius: 36px; font-size: 3rem; box-shadow: var(--shadow-card); }

.rating-summary { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 28px; align-items: center; }
.rating-summary .score { text-align: center; }
.rating-summary .score b { font-size: 3rem; font-weight: 800; line-height: 1; display: block; color: var(--navy-800); }
.bars { display: grid; gap: 6px; }
.bars div { display: grid; grid-template-columns: 28px minmax(0, 1fr) 36px; gap: 10px; align-items: center; font-size: .85rem; font-weight: 700; color: var(--ink-500); }
.bars .track { height: 8px; border-radius: 99px; background: var(--surface-sunken); overflow: hidden; }
.bars .track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--gold-500), var(--gold-600)); }
.review { padding: 18px 0; border-bottom: 1px solid var(--line); }
.review:last-child { border-bottom: 0; }
.review-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.review-head .avatar { width: 40px; height: 40px; border-radius: 12px; font-size: 1rem; }
.review p { margin: 0; color: var(--ink-700); }
.star-input { display: flex; flex-direction: row-reverse; justify-content: flex-end; gap: 4px; }
.star-input input { position: absolute; opacity: 0; pointer-events: none; }
.star-input label { cursor: pointer; color: var(--ink-300); }
.star-input label .icon { width: 30px; height: 30px; stroke: currentColor; fill: none; transition: transform .15s; }
.star-input label:hover .icon { transform: scale(1.12); }
.star-input input:checked ~ label .icon, .star-input label:hover .icon, .star-input label:hover ~ label .icon { fill: var(--gold-500); stroke: var(--gold-500); }
.star-input input:focus-visible + label { outline: 3px solid var(--brand-300); border-radius: 6px; }
@media (max-width: 1120px) { .book-layout { grid-template-columns: 260px minmax(0, 1fr); } .buy-col { grid-column: 1 / -1; } .buy-box { position: static; } }
@media (max-width: 720px) {
  .book-layout { grid-template-columns: 1fr; gap: 24px; }
  .book-cover-lg { position: static; max-width: 230px; margin-inline: auto; }
  .book-info { text-align: start; }
  .rating-summary { grid-template-columns: 1fr; }
}

.detail-sections { display: grid; gap: 22px; }

/* ---------- Collections ---------- */
.col-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.col-card { display: flex; flex-direction: column; gap: 14px; padding: 22px; border-radius: var(--radius-2xl); background: #fff; border: 1px solid var(--line); color: var(--ink-900); transition: transform .3s var(--ease), box-shadow .3s; }
.col-card:hover { color: var(--ink-900); transform: translateY(-4px); box-shadow: var(--shadow-card); }
.col-covers { display: flex; height: 150px; align-items: flex-end; padding: 16px 16px 0; border-radius: 18px; background: linear-gradient(150deg, var(--brand-50), #e6edf7); overflow: hidden; }
.col-covers img, .col-covers .ph { width: 86px; aspect-ratio: 2/3; object-fit: cover; border-radius: 6px 10px 10px 6px; box-shadow: 0 12px 24px -10px rgb(20 45 80 / .5); margin-inline-end: -26px; transition: transform .35s var(--ease); background: var(--brand-300); }
.col-card:hover .col-covers img:nth-child(1) { transform: translateY(-8px) rotate(-3deg); }
.col-card:hover .col-covers img:nth-child(2) { transform: translateY(-4px); }
.col-card h3 { margin: 0; }
.col-card p { margin: 0; color: var(--ink-500); font-size: .92rem; }

/* ---------- Author page ---------- */
.author-hero { background: linear-gradient(135deg, var(--navy-900), var(--navy-700) 65%, var(--brand-700)); color: #dbe7f1; position: relative; overflow: hidden; }
.author-hero::after { content: ""; position: absolute; width: 380px; height: 380px; border-radius: 50%; border: 40px solid rgb(254 195 0 / .12); inset-inline-start: -120px; bottom: -200px; }
.author-hero .container { position: relative; z-index: 1; padding-block: 44px; display: flex; gap: 30px; align-items: center; flex-wrap: wrap; }
.author-hero h1 { color: #fff; margin-bottom: 6px; }
.author-hero .breadcrumbs a, .author-hero .breadcrumbs { color: #9fb5c9; }
.author-hero .stats-inline { display: flex; gap: 26px; flex-wrap: wrap; margin-top: 16px; }
.author-hero .stats-inline b { display: block; font-size: 1.4rem; color: #fff; line-height: 1.2; }
.author-hero .stats-inline span { font-size: .82rem; color: #9fb5c9; font-weight: 700; }

/* ---------- Static pages ---------- */
.page-hero { padding: 54px 0 44px; background:
  radial-gradient(700px 300px at 100% 0%, rgb(43 156 214 / .14), transparent 70%),
  linear-gradient(180deg, #fff, var(--surface-muted)); border-bottom: 1px solid var(--line); }
.page-hero h1 { font-size: clamp(1.9rem, 3.8vw, 2.8rem); }
.page-hero p.lead { font-size: 1.1rem; color: var(--ink-700); max-width: 680px; }
.page-hero.dark { background: linear-gradient(130deg, var(--navy-900), var(--navy-700) 60%, var(--brand-700)); border: 0; color: #dbe7f1; }
.page-hero.dark h1 { color: #fff; }
.page-hero.dark p.lead { color: #c2d4e4; }
.page-hero.dark .eyebrow { color: var(--gold-400); }
.page-hero.dark .breadcrumbs, .page-hero.dark .breadcrumbs a { color: #9fb5c9; }
.page-hero .container.split-hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: 40px; align-items: center; }
@media (max-width: 860px) { .page-hero .container.split-hero { grid-template-columns: 1fr; } }
.legal { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 36px; align-items: start; }
.legal-toc { position: sticky; top: calc(var(--header-h) + 20px); padding: 18px; }
.legal-toc b { display: block; margin-bottom: 8px; font-size: .85rem; color: var(--ink-400); }
.legal-toc a { display: block; padding: 6px 0; font-weight: 700; font-size: .9rem; color: var(--ink-700); }
.legal-toc a:hover { color: var(--brand-600); }
.legal article { padding: 34px; }
.legal article h2 { scroll-margin-top: calc(var(--header-h) + 20px); }
@media (max-width: 860px) { .legal { grid-template-columns: 1fr; } .legal-toc { position: static; } .legal article { padding: 22px; } }
.faq-list { display: grid; gap: 12px; }
.faq-item { background: #fff; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.faq-item summary { list-style: none; cursor: pointer; padding: 18px 22px; font-weight: 800; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary .icon { transition: transform .25s var(--ease); color: var(--brand-600); flex: none; }
.faq-item[open] summary .icon { transform: rotate(45deg); }
.faq-item[open] summary { color: var(--brand-700); }
.faq-item .answer { padding: 0 22px 20px; color: var(--ink-700); line-height: 1.9; }
.faq-group h2 { font-size: 1.15rem; margin: 30px 0 14px; display: flex; align-items: center; gap: 10px; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.feature { padding: 24px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-xl); }
.feature .f-icon { width: 50px; height: 50px; border-radius: 15px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand-600); margin-bottom: 14px; }
.feature h3 { margin-bottom: 6px; }
.feature p { margin: 0; color: var(--ink-500); font-size: .93rem; line-height: 1.75; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; counter-reset: s; }
.step { position: relative; padding: 24px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-xl); counter-increment: s; }
.step::before { content: counter(s); width: 40px; height: 40px; border-radius: 13px; background: var(--navy-800); color: var(--gold-400); display: grid; place-items: center; font-weight: 800; margin-bottom: 14px; font-size: 1.05rem; }
.step h3 { font-size: 1.02rem; margin-bottom: 6px; }
.step p { color: var(--ink-500); font-size: .9rem; margin: 0; line-height: 1.7; }
@media (max-width: 960px) { .steps { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .steps { grid-template-columns: 1fr; } }
.calc { padding: 26px; }
.calc .result { margin-top: 16px; padding: 16px; border-radius: 16px; background: var(--navy-900); color: #fff; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.calc .result b { font-size: 1.6rem; color: var(--gold-400); }
.compare { width: 100%; border-collapse: separate; border-spacing: 0; background: #fff; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.compare th, .compare td { padding: 14px 18px; border-bottom: 1px solid var(--line); text-align: start; }
.compare thead th { background: var(--navy-900); color: #fff; font-size: .9rem; }
.compare tr:last-child td { border-bottom: 0; }
.compare td:first-child { font-weight: 700; color: var(--ink-700); }
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.contact-card { padding: 26px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-xl); display: flex; flex-direction: column; gap: 10px; }
.contact-card .c-icon { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand-600); }
.contact-card.wa .c-icon { background: #e7f8ee; color: #128c4b; }
.contact-card b { font-size: 1.05rem; }
.cover-fan { display: flex; justify-content: center; align-items: flex-end; height: 260px; }
.cover-fan img, .cover-fan .ph { width: 128px; aspect-ratio: 2/3; object-fit: cover; border-radius: 8px 12px 12px 8px; box-shadow: 0 24px 40px -18px rgb(5 15 30 / .7); margin-inline: -22px; background: var(--brand-300); }
.cover-fan img:nth-child(1) { transform: rotate(-12deg) translateY(16px); }
.cover-fan img:nth-child(2) { transform: rotate(-5deg); z-index: 1; }
.cover-fan img:nth-child(3) { transform: translateY(-14px); z-index: 2; width: 146px; }
.cover-fan img:nth-child(4) { transform: rotate(5deg); z-index: 1; }
.cover-fan img:nth-child(5) { transform: rotate(12deg) translateY(16px); }
@media (max-width: 520px) { .cover-fan img, .cover-fan .ph { width: 92px; } .cover-fan img:nth-child(3) { width: 104px; } .cover-fan { height: 190px; } }

/* ---------- Mobile refinements ---------- */
@media (max-width: 560px) {
  .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 14px; }
  .book-row { grid-auto-columns: 42%; gap: 14px; }
  .cat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .cat-tile { min-height: 88px; padding: 14px; }
  .book-meta h3 { font-size: .9rem; }
  .section { padding: 40px 0; }
  .hero h1 { font-size: 1.85rem; }
  .list-search { max-width: none; }
  .sort-select { width: 100%; justify-content: space-between; }
  .list-toolbar { gap: 10px; }
  /* ترويسة: زر «حساب جديد» يزاحم الشعار على الشاشات الضيقة — يكفي «دخول» */
  .header-actions .btn-primary { display: none; }
}

/* ───────── المفضلة ───────── */
.book-card-wrap { position: relative; min-width: 0; }
.book-card-wrap .wish-form { position: absolute; top: 8px; inset-inline-end: 8px; z-index: 3; margin: 0; }
.book-card-wrap > .wish-btn { position: absolute; top: 8px; inset-inline-end: 8px; z-index: 3; }
.wish-btn { width: 34px; height: 34px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer;
  background: rgb(255 255 255 / .92); color: var(--ink-500); box-shadow: 0 2px 10px -2px rgb(20 45 80 / .35);
  transition: transform .2s var(--ease), color .2s, background .2s; padding: 0; }
.wish-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.wish-btn:hover { color: #e0245e; transform: scale(1.08); }
.wish-btn.is-on { color: #e0245e; }
.wish-btn.is-on svg { fill: #e0245e; }
.wish-btn.is-pulse { animation: wishPulse .45s var(--ease); }
@keyframes wishPulse { 0% { transform: scale(1); } 40% { transform: scale(1.3); } 100% { transform: scale(1); } }
.book-card-wrap .wish-form, .book-card-wrap > .wish-btn { opacity: .0; transition: opacity .2s; }
.book-card-wrap:hover .wish-form, .book-card-wrap:hover > .wish-btn, .book-card-wrap:focus-within .wish-form,
.book-card-wrap:focus-within > .wish-btn, .book-card-wrap .wish-form:has(.is-on) { opacity: 1; }
@media (hover: none) { .book-card-wrap .wish-form, .book-card-wrap > .wish-btn { opacity: 1; } }
.wish-form-big { margin: 0; width: 100%; }
.wish-btn-big { width: 100%; height: 44px; border-radius: var(--radius); gap: 8px; display: inline-flex; align-items: center;
  justify-content: center; background: #fff; border: 1px solid var(--line); box-shadow: none; color: var(--ink-700);
  font: inherit; font-weight: 700; font-size: .95rem; text-decoration: none; }
.wish-btn-big:hover { transform: none; border-color: #f5a3bd; background: #fff5f8; color: #c2185b; }
.wish-btn-big.is-on { background: #fff0f5; border-color: #f5a3bd; color: #c2185b; }
.book-cover-lg .actions { display: grid; gap: 10px; }
.book-card-wrap.is-removing { opacity: 0; transform: scale(.96); transition: all .3s var(--ease); }

/* ───────── التصنيفات الفرعية ───────── */
.sub-chips { align-items: center; padding: 8px 10px; background: var(--brand-50); border-radius: var(--radius-lg); }
.chip-sub { background: #fff; font-size: .84rem; padding: 5px 12px; }
.chip-sub.is-active { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }

/* ───────── دور النشر ───────── */
.section-pad-b { padding-block: 28px 56px; }
.publisher-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 20px; }
.publisher-card { padding: 22px; display: flex; flex-direction: column; gap: 12px; color: var(--ink-900); transition: transform .25s var(--ease), box-shadow .25s; }
.publisher-card:hover { color: var(--ink-900); transform: translateY(-4px); box-shadow: var(--shadow-card); }
.publisher-card .pc-head { display: flex; gap: 12px; align-items: center; }
.publisher-card h2 { font-size: 1.1rem; margin: 0; }
.publisher-card .pc-bio { margin: 0; }
.pc-covers { display: flex; gap: 8px; }
.pc-covers img { width: 64px; aspect-ratio: 2/3; object-fit: cover; border-radius: 6px; box-shadow: var(--shadow-soft); }
.publisher-badge { vertical-align: middle; font-size: .75rem; margin-inline-start: 6px; }
.rating-inline { white-space: nowrap; flex-wrap: nowrap; }
.rating-inline .star-row { display: inline-flex; gap: 1px; }
.byline > span { white-space: nowrap; }
