/* ==========================================================================
   shelves.css — شريط التمرير الأفقي للرفوف (الكتب، الاقتباسات، الصوتيات).
   الـ class: .horizontal-scroll
   ========================================================================== */
.horizontal-scroll::-webkit-scrollbar { height: 7px; }
.horizontal-scroll::-webkit-scrollbar-track { background: #ECE5D8; border-radius: 10px; }
.horizontal-scroll::-webkit-scrollbar-thumb { background: #C8A143; border-radius: 10px; }
.horizontal-scroll::-webkit-scrollbar-thumb:hover { background: #B99035; }

/* ==========================================================================
   كتب في وضع الجوال (أقل من 640px): شبكة عمودين وبطاقات أصغر.
   - الرئيسية (#books-shelf-items): تُعرض 4 كتب فقط (عمودان × صفان) وبقية الكتب في صفحة "كل الكتب".
   - صفحة كل الكتب (.abugroon-books-grid): كل الكتب بعمودين.
   الكمبيوتر والتابلت (640px فأكثر) بلا تغيير.
   ========================================================================== */
.abugroon-books-more--mobile-only { display: none; }

@media (max-width: 639px) {
  #books-shelf-items {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    overflow-x: visible;
    padding-bottom: 0;
  }
  #books-shelf-items > div:nth-child(n+5) { display: none; }
  .abugroon-books-grid.grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }

  #books-shelf .abugroon-books-hint { display: none; }
  .abugroon-books-more--mobile-only { display: block; }

  :is(#books-shelf-items, .abugroon-books-grid) > div {
    width: auto;
    min-width: 0;
    max-width: none;
    padding: 0.625rem;
    border-radius: 0.875rem;
  }
  :is(#books-shelf-items, .abugroon-books-grid) > div > a:first-child {
    height: 9.5rem;
    padding: 0.375rem;
    margin-bottom: 0.5rem;
    border-radius: 0.625rem;
  }
  :is(#books-shelf-items, .abugroon-books-grid) > div > h4 {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    height: auto;
    min-height: 2.4em;
    font-size: 0.75rem;
    line-height: 1.2;
  }
  :is(#books-shelf-items, .abugroon-books-grid) > div > p {
    height: auto;
    margin-bottom: 0.5rem;
    font-size: 0.625rem;
  }
  :is(#books-shelf-items, .abugroon-books-grid) > div > a:last-child {
    padding-block: 0.375rem;
    font-size: 0.6875rem;
  }
}

/* ==========================================================================
   الاقتباسات على الجوال (< 640px): عمودان وبطاقات أصغر، 4 اقتباسات فقط (صفّان)
   والباقي في صفحة كل الاقتباسات عبر زر "عرض المزيد".
   ========================================================================== */
@media (max-width: 639px) {
  #quotes-shelf-container {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    overflow-x: visible;
    padding-bottom: 0;
  }
  #quotes-shelf-container > div:nth-child(n+5) { display: none; }
  #quotes-shelf-container > div {
    width: auto;
    min-width: 0;
    max-width: none;
    padding: 0.75rem;
    border-radius: 0.875rem;
  }
  #quotes-shelf-container > div > div:first-child > div:first-child { flex-wrap: wrap; gap: 0.25rem; margin-bottom: 0.5rem; }
  #quotes-shelf-container h4 { font-size: 0.875rem; margin-bottom: 0.375rem; }
  #quotes-shelf-container p { font-size: 0.75rem; margin-bottom: 0.5rem; }
  #quotes-shelf-container span { font-size: 0.625rem; }
  #quotes-shelf-container > div > div:last-child { padding-top: 0.5rem; }
  #quotes-shelf-container button[onclick^="quickShare"] { display: none; }
  #articles-section button[onclick^="scrollQuotesShelf"] { display: none; }
}

/* ==========================================================================
   الصوتيات على الجوال (< 640px): عمودان وبطاقات أصغر (4 مقاطع كحد أقصى في الرئيسية).
   ========================================================================== */
@media (max-width: 639px) {
  #audios-shelf-items {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    overflow-x: visible;
    padding-bottom: 0;
  }
  #audios-shelf-items > div:nth-child(n+5) { display: none; }
  .abugroon-audios-grid.grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
  #audios-shelf .abugroon-audios-hint { display: none; }

  :is(#audios-shelf-items, .abugroon-audios-grid) > div {
    width: auto;
    min-width: 0;
    max-width: none;
    padding: 0.625rem;
    border-radius: 0.875rem;
  }
  :is(#audios-shelf-items, .abugroon-audios-grid) > div > div:first-child { margin-bottom: 0.5rem; }
  :is(#audios-shelf-items, .abugroon-audios-grid) > div > div:first-child > div:first-child { flex-wrap: wrap; gap: 0.25rem; margin-bottom: 0.375rem; }
  :is(#audios-shelf-items, .abugroon-audios-grid) h4 { font-size: 0.8125rem; line-height: 1.3; }
  :is(#audios-shelf-items, .abugroon-audios-grid) p { font-size: 0.6875rem; }
  :is(#audios-shelf-items, .abugroon-audios-grid) span { font-size: 0.625rem; }
  :is(#audios-shelf-items, .abugroon-audios-grid) > div > div:last-child { padding: 0.375rem; border-radius: 0.625rem; }
  :is(#audios-shelf-items, .abugroon-audios-grid) .abugroon-embed { height: 5.5rem; }
  :is(#audios-shelf-items, .abugroon-audios-grid) .abugroon-embed__icon { width: 2rem; height: 2rem; font-size: 0.75rem; }
  :is(#audios-shelf-items, .abugroon-audios-grid) > div > div:last-child > div:last-child { flex-wrap: wrap; justify-content: center; gap: 0.25rem; padding-top: 0.25rem; }
  :is(#audios-shelf-items, .abugroon-audios-grid) > div > div:last-child > div:last-child > span { display: none; }
}
