/* =========================================================
   Altawhed Mag - user.css (Cassiopeia, Joomla 5.4)
   Save this file as UTF-8.
   ========================================================= */

/* 1. Fonts - the @import line must stay the very first rule in the file */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@600;700&family=Tajawal:wght@400;500;700&display=swap');

/* 2. Colors and fonts */
:root {
  --cassiopeia-color-primary: #003e57;
  --cassiopeia-color-hover: #0a6a8a;
  --cassiopeia-color-link: #0a6a8a;

  --bs-body-font-family: 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
  --font-headings: 'Cairo', 'Tajawal', sans-serif;
}

body {
  font-family: var(--bs-body-font-family);
  font-size: 1.05rem;
  line-height: 1.85;
  background-color: #faf8f3;
  color: #1f2937;
}

button, input, select, textarea, .mod-menu {
  font-family: var(--bs-body-font-family);
}

h1, h2, h3, h4, h5, h6,
.page-header h1,
.issues-grid-title {
  font-family: var(--font-headings);
  line-height: 1.5;
}

/* Header: one solid color instead of the default gradient */
.container-header {
  background-image: none;
  background-color: var(--cassiopeia-color-primary);
}

a:hover { color: var(--cassiopeia-color-hover); }


/* =========================================================
   3. Year groups in the main menu (built by user.js)
   ========================================================= */
.mod-menu .year-group { list-style: none; margin-block: .25rem; }

.mod-menu .year-group > details > summary {
  cursor: pointer;
  font-weight: 700;
  padding: .55rem .8rem;
  border-radius: .5rem;
  background: color-mix(in srgb, currentColor 8%, transparent);
}
.mod-menu .year-group > details > summary:hover {
  background: color-mix(in srgb, currentColor 14%, transparent);
}

.mod-menu .year-group > details > ul {
  list-style: none;
  margin: .3rem 0 .6rem;
  padding: 0;
  padding-inline-start: .75rem;
  max-height: 18rem;
  overflow-y: auto;
}
.mod-menu .year-group > details > ul a {
  display: block;
  padding: .3rem .5rem;
}


/* =========================================================
   4. Latest issues and latest books grids (home page)
   ========================================================= */
.issues-grid-wrap { margin-block: 1.5rem; }
.issues-grid-title { font-size: 1.3rem; margin-bottom: .75rem; }

.issues-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
}
.issues-grid a {
  display: block;
  text-align: center;
  text-decoration: none;
  color: inherit;
}
.issues-grid img {
  width: 100%;
  aspect-ratio: 5 / 7;
  object-fit: cover;
  border-radius: .5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
  background: color-mix(in srgb, currentColor 8%, transparent);
  transition: transform .2s;
}
.issues-grid a:hover img { transform: translateY(-4px); }
.issue-num { display: block; margin-top: .5rem; font-weight: 700; }
.issue-date { display: block; font-size: .85rem; opacity: .75; }

.books-grid .issue-num {
  font-size: .95rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.issues-more { margin-top: .75rem; text-align: end; }
.issues-more a { font-weight: 700; }


/* =========================================================
   5. Download buttons (PDF / ePub / Telegram links in articles)
   ========================================================= */
main a[href$=".pdf" i]:not(td a):not(li a),
main a[href$=".epub" i]:not(td a):not(li a),
main a[href*="t.me/"]:not(td a):not(li a) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 48px;              /* comfortable touch target */
  padding: .6rem 1.4rem;
  margin: .35rem .25rem;
  border: 2px solid var(--cassiopeia-color-primary, #003e57);
  border-radius: 999px;
  font-weight: 700;
  line-height: 1.3;
  text-decoration: none;
  transition: background-color .2s, color .2s, transform .1s;
}

/* PDF: solid primary button */
main a[href$=".pdf" i]:not(td a):not(li a) {
  background: var(--cassiopeia-color-primary, #003e57);
  color: #fff;
}
main a[href$=".pdf" i]:not(td a):not(li a):hover {
  background: var(--cassiopeia-color-hover, #0a6a8a);
  border-color: var(--cassiopeia-color-hover, #0a6a8a);
  color: #fff;
}

/* ePub: outline button */
main a[href$=".epub" i]:not(td a):not(li a) {
  background: transparent;
  color: var(--cassiopeia-color-primary, #003e57);
}
main a[href$=".epub" i]:not(td a):not(li a):hover {
  background: var(--cassiopeia-color-primary, #003e57);
  color: #fff;
}

/* Telegram alternative links: quieter secondary buttons */
main a[href*="t.me/"]:not(td a):not(li a) {
  min-height: 44px;
  padding: .45rem 1.1rem;
  font-size: .95rem;
  font-weight: 500;
  color: inherit;
  border-color: color-mix(in srgb, currentColor 30%, transparent);
  background: color-mix(in srgb, currentColor 7%, transparent);
}
main a[href*="t.me/"]:not(td a):not(li a):hover {
  background: color-mix(in srgb, currentColor 14%, transparent);
}

/* Small press effect on touch */
main a[href$=".pdf" i]:not(td a):not(li a):active,
main a[href$=".epub" i]:not(td a):not(li a):active,
main a[href*="t.me/"]:not(td a):not(li a):active {
  transform: scale(.97);
}

/* Mobile: full-width stacked buttons */
@media (max-width: 575.98px) {
  main a[href$=".pdf" i]:not(td a):not(li a),
  main a[href$=".epub" i]:not(td a):not(li a),
  main a[href*="t.me/"]:not(td a):not(li a) {
    display: flex;
    width: 100%;
    margin-inline: 0;
  }
}


/* =========================================================
   6. Quick links (side menu)
   ========================================================= */
.quick-links {
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
.quick-links .ql {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-height: 48px;
  padding: .6rem 1rem;
  border: 2px solid var(--cassiopeia-color-primary, #003e57);
  border-radius: .75rem;
  background: transparent;
  color: var(--cassiopeia-color-primary, #003e57);
  font-family: var(--font-headings, inherit);
  font-weight: 700;
  line-height: 1.3;
  text-decoration: none;
  transition: background-color .2s, color .2s, transform .1s;
}
.quick-links .ql:hover {
  background: var(--cassiopeia-color-primary, #003e57);
  color: #fff;
}
.quick-links .ql:active { transform: scale(.98); }

/* "Newest issue" button is the highlighted one */
.quick-links .ql-primary {
  background: var(--cassiopeia-color-primary, #003e57);
  color: #fff;
}
.quick-links .ql-primary:hover {
  background: var(--cassiopeia-color-hover, #0a6a8a);
  border-color: var(--cassiopeia-color-hover, #0a6a8a);
}

.quick-links .ql-icon {
  width: 1.75rem;
  font-size: 1.35rem;
  line-height: 1;
  text-align: center;
}

/* Phones and tablets: buttons in a grid */
@media (max-width: 991.98px) {
  .quick-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }
}


/* =========================================================
   7. Header banner + social links
   ========================================================= */

/* The header slot is a flex row, so make the module fill the whole row */
.container-header .container-below-top {
  flex: 1 1 100%;
  width: 100%;
  max-width: 100%;
}
.container-below-top p { margin: 0; }

.site-hero {
  flex: 1 1 100%;
  width: 100%;
  text-align: center;
}
.site-hero-link { display: block; }

.site-hero-img {
  display: block;
  width: 100%;
  max-width: 780px;
  height: auto;
  margin-inline: auto;
  /* fades the image edges into the header color */
-webkit-mask-image: linear-gradient(to right, transparent, #000 15%, #000 85%, transparent);
        mask-image: linear-gradient(to right, transparent, #000 15%, #000 85%, transparent);
}

.social-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  padding: .75rem 0 .25rem;
}
.social-bar-title {
  margin-inline-end: .4rem;
  font-weight: 700;
  color: #fff;
}

.social-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 2px solid rgba(255, 255, 255, .6);
  border-radius: 50%;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  text-decoration: none;
  transition: background-color .2s, color .2s, transform .15s;
}
.social-link:hover {
  background: #fff;
  color: var(--cassiopeia-color-primary, #003e57);
  transform: translateY(-2px);
}

/* Screen-reader-only text inside each link */
.social-link > span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Icons drawn with CSS - no icon font and no extra HTML needed */
.social-link::before {
  content: "";
  width: 22px;
  height: 22px;
  background-color: currentColor;
  -webkit-mask: var(--ico) center / contain no-repeat;
          mask: var(--ico) center / contain no-repeat;
}

/* Telegram */
.social-link[href*="t.me/"] {
  --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 2 11 13'/%3E%3Cpath d='M22 2 15 22l-4-9-9-4z'/%3E%3C/svg%3E");
}
/* Facebook */
.social-link[href*="facebook.com/"] {
  --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z'/%3E%3C/svg%3E");
}
/* X (Twitter) */
.social-link[href*="x.com/"] {
  --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z'/%3E%3C/svg%3E");
}
/* YouTube */
.social-link[href*="youtube.com/"] {
  --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22.54 6.42a2.78 2.78 0 0 0-1.94-2C18.88 4 12 4 12 4s-6.88 0-8.6.46a2.78 2.78 0 0 0-1.94 2A29 29 0 0 0 1 11.75a29 29 0 0 0 .46 5.33A2.78 2.78 0 0 0 3.4 19c1.72.46 8.6.46 8.6.46s6.88 0 8.6-.46a2.78 2.78 0 0 0 1.94-2 29 29 0 0 0 .46-5.25 29 29 0 0 0-.46-5.33z'/%3E%3Cpath d='M9.75 15.02 15.5 11.75 9.75 8.48z'/%3E%3C/svg%3E");
}
/* Instagram */
.social-link[href*="instagram.com/"] {
  --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='2' width='20' height='20' rx='5'/%3E%3Cpath d='M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z'/%3E%3Cpath d='M17.5 6.5h.01'/%3E%3C/svg%3E");
}

@media (max-width: 575.98px) {
  .site-hero-img {
    max-width: none;
    -webkit-mask-image: linear-gradient(to right, transparent, #000 3%, #000 97%, transparent);
            mask-image: linear-gradient(to right, transparent, #000 3%, #000 97%, transparent);
  }
  .social-bar-title { width: 100%; text-align: center; }
}




/* Banner position: full-width strip in the header color */
.container-banner {
  background-color: var(--cassiopeia-color-primary);
  padding-top: .5rem;
}





/* =========================================================
   8. Footer + back-to-top button
   ========================================================= */
.container-footer {
  background-image: none;
  background-color: var(--cassiopeia-color-primary);
  border-top: 4px solid var(--cassiopeia-color-hover);
  color: #fff;
  font-size: .95rem;
  padding-block: 1.5rem;
  margin-top: 2rem;
}
.container-footer .grid-child {
  justify-content: center;
  text-align: center;
}
.container-footer a {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.container-footer a:hover { color: #bfe3f0; }
.container-footer .mod-menu a { text-decoration: none; }
.container-footer p { margin-block: .25rem; }

/* Back-to-top button */
.back-to-top-link {
  background-color: var(--cassiopeia-color-primary);
  border: 2px solid rgba(255, 255, 255, .6);
  border-radius: 50%;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}
.back-to-top-link:hover,
.back-to-top-link:focus {
  background-color: var(--cassiopeia-color-hover);
  color: #fff;
}












/* Plain text links: use the site link color */
a:not([class]):not([href$=".pdf" i]):not([href$=".epub" i]):not([href*="t.me/"]) {
  color: var(--cassiopeia-color-link);
}
a:not([class]):not([href$=".pdf" i]):not([href$=".epub" i]):not([href*="t.me/"]):hover {
  color: var(--cassiopeia-color-primary);
}






/* Footer: stack the modules vertically and center them */
.container-footer .grid-child {
  flex-direction: column;
  align-items: center;
  gap: .75rem;
}

/* Visits counter styled as a pill matching the header's social icons */
.container-footer .stats-module,
.container-footer .list-group {
  margin: 0;
  padding: 0;
  list-style: none;
  background: none;
  border: 0;
}
.container-footer .list-group-item {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  padding: .45rem 1.1rem;
  background: rgba(255, 255, 255, .1);
  border: 2px solid rgba(255, 255, 255, .35);
  border-radius: 999px !important;
  color: #fff;
  font-weight: 500;
}
.container-footer .list-group-item .badge {
  background: #fff !important;
  color: var(--cassiopeia-color-primary, #003e57) !important;
  font-size: .9rem;
  font-weight: 700;
}






/* =========================================================
   9. Issue page (articles that contain a PDF link)
   ========================================================= */
.com-content-article:has(a[href$=".pdf" i]) .page-header {
  text-align: center;
}

.com-content-article__body:has(a[href$=".pdf" i]) {
  max-width: 640px;
  margin-inline: auto;
  text-align: center;
}

/* Cover image */
.com-content-article__body:has(a[href$=".pdf" i]) img {
  display: block;
  width: 100%;
  max-width: 360px;
  height: auto;
  margin: .5rem auto 1.5rem;
  border-radius: .5rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
}

/* Section headings above the alternative links */
.com-content-article__body:has(a[href$=".pdf" i]) :is(h2, h3, h4) {
  margin-top: 1.75rem;
  font-size: 1.1rem;
}











/* =========================================================
   10. Search box (sidebar)
   ========================================================= */

/* Hide the visible label (kept for screen readers) */
.mod-finder label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.mod-finder .input-group {
  flex-wrap: nowrap;
  gap: .5rem;
}
.mod-finder .input-group > :not(:first-child) {
  margin-inline-start: 0;
}

.mod-finder .form-control {
  min-height: 44px;
  padding-inline: 1.1rem;
  border: 2px solid var(--cassiopeia-color-primary, #003e57);
  border-radius: 999px !important;
  background: #fff;
  color: #1f2937;
}
.mod-finder .form-control:focus {
  border-color: var(--cassiopeia-color-hover, #0a6a8a);
  box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--cassiopeia-color-hover, #0a6a8a) 25%, transparent);
}

.mod-finder .btn {
  min-height: 44px;
  padding-inline: 1.2rem;
  border: 0;
  border-radius: 999px !important;
  background: var(--cassiopeia-color-primary, #003e57);
  color: #fff;
  font-weight: 700;
}
.mod-finder .btn:hover,
.mod-finder .btn:focus {
  background: var(--cassiopeia-color-hover, #0a6a8a);
  color: #fff;
}











/* =========================================================
   11. Search results page
   ========================================================= */
#search-result-list mark,
#search-result-list .highlight {
  background: #bfe3f0;
  color: inherit;
  padding: 0 .15em;
  border-radius: .2em;
}

#search-result-list {
  list-style: none;
  padding: 0;
  margin: 1.25rem 0 0;
}
#search-result-list .result__item {
  margin-bottom: .75rem;
  padding: 1rem 1.25rem;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, .1);
  border-radius: .75rem;
}
#search-result-list .result__title {
  margin: 0 0 .35rem;
  font-family: var(--font-headings);
  font-size: 1.15rem;
  font-weight: 700;
}
#search-result-list .result__description {
  margin: 0;
  font-size: .95rem;
  line-height: 1.8;
}
#search-result-list .result__title-url { display: none; }




/* Search results: keep only the group (category), hide type and author */
#search-result-list li ul > li:nth-child(-n+2) { display: none; }
#search-result-list li ul > li { border: 0; }
#search-result-list li ul > li::before { content: none; }







/* Hide the article creation date in search results */
#search-result-list .result__date { display: none; }





/* =========================================================
   13. Article index (page-break table of contents)
   ========================================================= */
.article-index {
  float: none !important;
  width: 100%;
  margin: 1rem 0 1.5rem;
}
.article-index ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .4rem;
  max-height: 14rem;
  overflow-y: auto;
}
.article-index li a {
  display: block;
  padding: .4rem .75rem;
  border-radius: .5rem;
  background: color-mix(in srgb, currentColor 8%, transparent);
  font-size: .9rem;
  text-decoration: none;
}
.article-index li a:hover {
  background: color-mix(in srgb, currentColor 16%, transparent);
}
.article-index li a.active,
.article-index li a[aria-current] {
  background: var(--cassiopeia-color-primary, #003e57);
  color: #fff;
}






















/* =========================================================
   13. Issue indexes (article "فهارس مجلة التوحيد")
   ========================================================= */
.issue-index {
  width: 100%;
  margin: 1.25rem 0;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid color-mix(in srgb, currentColor 15%, transparent);
  border-radius: .75rem;
  overflow: hidden;
}
.issue-index th {
  padding: .75rem 1rem;
  background: var(--cassiopeia-color-primary, #003e57);
  color: #fff;
  font-family: var(--font-headings, inherit);
  text-align: start;
}
.issue-index th:last-child,
.issue-index td:last-child {
  width: 5.5rem;
  text-align: center;
}
.issue-index td {
  padding: .6rem 1rem;
  vertical-align: top;
  border-top: 1px solid color-mix(in srgb, currentColor 10%, transparent);
}
.issue-index tbody tr:nth-child(even) {
  background: color-mix(in srgb, currentColor 4%, transparent);
}
.issue-index td:last-child {
  font-weight: 700;
  color: var(--cassiopeia-color-hover, #0a6a8a);
}
.issue-index .a {
  display: block;
  margin-top: .15rem;
  font-size: .88rem;
  color: color-mix(in srgb, currentColor 65%, transparent);
}
.issue-note { font-size: .9rem; opacity: .8; }

@media (max-width: 575.98px) {
  .issue-index th,
  .issue-index td { padding: .5rem .65rem; }
}




/* =========================================================
   14. Years list (category list) as a grid of buttons
   ========================================================= */
.com-content-category__table,
table.category {
  display: block;
  border: 0;
  background: none;
}
.com-content-category__table thead,
table.category thead { display: none; }

.com-content-category__table tbody,
table.category tbody {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: .6rem;
}

.com-content-category__table tr,
table.category tr {
  display: flex;
  background: none;
}

/* Every cell: remove Bootstrap table borders and zebra stripes */
.com-content-category__table tr > *,
table.category tr > * {
  flex: 1;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
}
/* Hide cells that do not hold the year link */
.com-content-category__table tr > *:not(:has(a)),
table.category tr > *:not(:has(a)) { display: none; }

.com-content-category__table tr > * a,
table.category tr > * a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 3.5rem;
  padding: .6rem 1rem;
  border: 2px solid var(--cassiopeia-color-primary, #003e57);
  border-radius: .75rem;
  color: var(--cassiopeia-color-primary, #003e57);
  font-family: var(--font-headings, inherit);
  font-size: .95rem;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
  transition: background-color .2s, color .2s, transform .1s;
}
.com-content-category__table tr > * a:hover,
table.category tr > * a:hover {
  background: var(--cassiopeia-color-primary, #003e57);
  color: #fff;
}
.com-content-category__table tr > * a:active,
table.category tr > * a:active { transform: scale(.98); }


/* Keep the year buttons' text color above the generic link rules */
.com-content-category__table tr > * a,
table.category tr > * a {
  color: var(--cassiopeia-color-primary, #003e57) !important;
}
.com-content-category__table tr > * a:hover,
table.category tr > * a:hover {
  background: var(--cassiopeia-color-primary, #003e57);
  color: #fff !important;
}




/* Remove Bootstrap row borders inside the button grids */
.com-content-category__table > tbody,
.com-content-category__table tr,
table.category > tbody,
table.category tr {
  border: 0 !important;
  --bs-table-border-color: transparent;
}





/* =========================================================
   15. Article body text
   ========================================================= */
.com-content-article__body :is(p, li, div):not([align="center"]):not([style*="center"]):not(td *) {
  text-align: justify !important;
  text-justify: inter-word;
  max-width: 100%;
}


/* Justify normal paragraphs, but leave centered ones (titles) alone */
.com-content-article__body :is(p, li, div):not([align="center"]):not([style*="center"]) {
  text-align: justify !important;
  text-justify: inter-word;
  max-width: 100%;
}

/* Headings follow the reading direction */
.com-content-article__body :is(h1, h2, h3, h4, h5, h6) {
  text-align: start !important;
}

/* Images and tables never exceed the column */
.com-content-article__body img { max-width: 100%; height: auto; }
.com-content-article__body table { max-width: 100%; }





/* =========================================================
   16. Books page (Category Blog with cover images)
   ========================================================= */
body.books-page .blog-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1.5rem 1rem;
  columns: auto;
  margin: 1.25rem 0;
}
body.books-page .blog-item {
  width: auto;
  margin: 0;
  padding: 0;
}
body.books-page .blog-item .item-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  text-align: center;
}

/* Cover on top */
body.books-page .item-image {
  order: -1;
  float: none !important;
  width: 100%;
  margin: 0 0 .6rem;
}
body.books-page .item-image a { display: block; }
body.books-page .item-image img {
  display: block;
  width: 100% !important;
  height: auto !important;
  max-height: none !important;
  aspect-ratio: 5 / 7;
  object-fit: contain;
  border-radius: .5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
  transition: transform .2s;
}
body.books-page .item-image,
body.books-page .item-image a {
  height: auto !important;
  max-height: none !important;
  overflow: visible;
}
body.books-page .item-image a:hover img { transform: translateY(-4px); }

/* Title under the cover */
body.books-page .blog-item .page-header {
  margin: 0;
  padding: 0;
  border: 0;
}
body.books-page .blog-item .page-header h2 {
  margin: 0;
  font-size: .98rem;
  line-height: 1.5;
}
body.books-page .blog-item .page-header a {
  color: var(--cassiopeia-color-primary, #003e57) !important;
  text-decoration: none;
}

/* Hide intro text, info block and Read more: cover + title only */
body.books-page .blog-item .item-content > :not(.item-image):not(.page-header) {
  display: none;
}


/* Books page: never show download buttons in the cover grid */
body.books-page .blog-item a[href$=".pdf" i],
body.books-page .blog-item a[href$=".epub" i],
body.books-page .blog-item a[href*="t.me/"] {
  display: none !important;
}



/* =========================================================
   17. Volumes download page (year + download image link)
   ========================================================= */
.com-content-article__body:has(img[src*="allpdf"]) table {
  display: block;
  width: 100% !important;
  border: 0 !important;
  background: none !important;
}
.com-content-article__body:has(img[src*="allpdf"]) thead,
.com-content-article__body:has(img[src*="allpdf"]) tr:has(th) {
  display: none;
}
.com-content-article__body:has(img[src*="allpdf"]) tbody {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: .8rem;
}
.com-content-article__body:has(img[src*="allpdf"]) tr {
  display: flex !important;
  flex-direction: column;
  gap: .6rem;
  height: auto !important;
  padding: 1rem;
  border: 2px solid var(--cassiopeia-color-primary, #003e57) !important;
  border-radius: .75rem;
  background: #fff !important;
  text-align: center;
}
.com-content-article__body:has(img[src*="allpdf"]) td {
  display: block;
  width: auto !important;
  height: auto !important;
  padding: 0 !important;
  border: 0 !important;
  background: none !important;
  text-align: center !important;
}
.com-content-article__body:has(img[src*="allpdf"]) td:first-child {
  font-family: var(--font-headings, inherit);
  font-weight: 700;
  line-height: 1.5;
}

/* The picture link becomes a text button */
.com-content-article__body:has(img[src*="allpdf"]) td a {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: .55rem 1rem;
  border-radius: 999px;
  background: var(--cassiopeia-color-primary, #003e57);
  color: #fff !important;
  font-weight: 700;
  text-decoration: none;
  transition: background-color .2s;
}
.com-content-article__body:has(img[src*="allpdf"]) td a:hover {
  background: var(--cassiopeia-color-hover, #0a6a8a);
}
.com-content-article__body:has(img[src*="allpdf"]) td a img { display: none !important; }
.com-content-article__body:has(img[src*="allpdf"]) td a::before { content: "⬇ تحميل المجلد"; }



/* Volumes page: same text size in every card, button stays at the bottom */
.com-content-article__body:has(img[src*="allpdf"]) td:first-child,
.com-content-article__body:has(img[src*="allpdf"]) td:first-child * {
  font-size: 1.05rem !important;
  line-height: 1.5 !important;
  text-align: center !important;
}
.com-content-article__body:has(img[src*="allpdf"]) td:first-child {
  flex: 1 1 auto;
}
.com-content-article__body:has(img[src*="allpdf"]) td a {
  font-size: .95rem !important;
  line-height: 1.4 !important;
}



/* Volumes page: remove paragraph margins and unify the button text */
.com-content-article__body:has(img[src*="allpdf"]) td p {
  margin: 0 !important;
}
.com-content-article__body:has(img[src*="allpdf"]) td a,
.com-content-article__body:has(img[src*="allpdf"]) td a::before {
  font-size: .9rem !important;
  font-weight: 700 !important;
  line-height: 1.4 !important;
}
.com-content-article__body:has(img[src*="allpdf"]) tr {
  justify-content: space-between;
}




