/* ==========================================================================
   partner-banners.css — the partner banners box, the same on every page: a
   brand-blue strip with a short intro (icon · «مواقع أخرى») at its start,
   then the page's banners (images). On phones: the banners only — no blue,
   no intro — in the page's white with a light frame.

   1. .pbn            — where the box sits (home, about pages; the book,
                        audio and video pages right under their details
                        card), on the page's white
   2. .bnr-box        — the box: [intro] [banner] [banner] in one row on wide
                        screens; also used inside the arabic page and
                        guidance page grids, across a row (arabic-page.css,
                        guidance-page.css)
   3. .bnr            — one banner: a link around its image (1280×425);
                        .bnr--wide for the 1600×266 one (takes both banner
                        slots); a thin white ring on the blue

   Markup: src/includes/partner-band.html → partner-box.html (the intro, and
   which banners each page shows) → one include per banner, banner-*.html:

     <div class="bnr-box" data-reveal-group>
       <div class="bnr-box__intro">icon · «مواقع أخرى»</div>
       <a href="https://quranenc.com" class="bnr" target="_blank" rel="noopener">
         <img src="images/banner-quranenc.webp" alt="موسوعة القرآن الكريم — QuranEnc.com" width="1280" height="425">
         <span class="sr-only">(يفتح في تبويب جديد)</span>
       </a>
       … second banner …
     </div>
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Where the box sits — no band colour: the box is the frame
   -------------------------------------------------------------------------- */
.pbn__wrap {
  box-sizing: border-box;
  max-width: var(--cww, 1320px);
  margin: 0 auto;
  padding: 0 24px;
}

@media (max-width: 640px) {
  .pbn__wrap {
    padding: 0 16px;
  }
}

/* The space around the box:
   - home: 20px under the grey «المواد المميزة» section; «المحتوى الإرشادي»
     starts 64px under it (48px on phones) instead of its usual 112px;
   - book, audio, video, about: 24px under the details / vision card
     (material-page.css, about-page.css);
   - then 64px (48px on phones) of white before «قراءة الكتاب» / «ذات صلة»
     or the invitation band (a margin, so the sections — and the «قراءة
     الكتاب» jump — keep their own top). */
.page-home .pbn {
  padding-top: 20px;
}

.page-home .pbn + .guide .guide__inner {
  padding-top: 64px;
}

.page-material .pbn,
.page-audio .pbn,
.page-video .pbn,
.page-about .pbn {
  margin-bottom: 64px;
}

@media (max-width: 640px) {
  .page-home .pbn + .guide .guide__inner {
    padding-top: 48px;
  }

  .page-material .pbn,
  .page-audio .pbn,
  .page-video .pbn,
  .page-about .pbn {
    margin-bottom: 48px;
  }
}

/* --------------------------------------------------------------------------
   2. The box — the brand blue, a soft light at its start corner and the
      site's calligraphy ornament, faint, behind the intro
   -------------------------------------------------------------------------- */
.bnr-box {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)); /* intro · banner · banner */
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-radius: 28px;
  background:
    radial-gradient(70% 140% at 88% 0%, rgba(255, 255, 255, .12) 0%, rgba(255, 255, 255, 0) 70%),
    var(--color-blue-500);
  color: var(--color-white);
}

.bnr-box::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: -70px;
  right: -60px;
  width: 280px;
  height: 280px;
  background: url("../../images/pattern-calligraphy.webp") center / contain no-repeat;
  filter: brightness(0) invert(1);
  opacity: .08;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(closest-side, #000 30%, transparent 100%);
  mask-image: radial-gradient(closest-side, #000 30%, transparent 100%);
}

/* the intro: an icon in a white circle and «مواقع أخرى» (its second word
   cream), centred in its slot (on tablets, in its row above the banners) */
.bnr-box__intro {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-width: 0;
  padding: 0 8px;
}

.bnr-box__icon {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--color-white);
  color: var(--color-blue-500);
}

.bnr-box__icon svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bnr-box__title {
  min-width: 0;
  font-family: 'Almarai', 'Cairo', sans-serif;
  font-weight: 800;
  font-size: 22px;
  line-height: 1.35;
}

.bnr-box__accent {
  color: var(--color-cream-300);
}

/* --------------------------------------------------------------------------
   3. One banner — the image is the whole banner (name, logo, "تصفح الآن");
      on the blue, a thin white ring
   -------------------------------------------------------------------------- */
.bnr {
  display: block;
  overflow: hidden;
  border-radius: 14px;
  background: rgba(255, 255, 255, .12); /* until the image arrives */
  color: var(--color-white);            /* alt text if an image fails, and the sr-only note */
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .28);
  transition: box-shadow .3s ease;
}

.bnr img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1280 / 425;
  object-fit: cover;
  transition: filter .3s ease;
}

/* the wide banner (1600×266) takes both banner slots */
.bnr--wide {
  grid-column: span 2;
}

.bnr--wide img {
  aspect-ratio: 1600 / 266;
}

/* hover: a cream ring (the site's hover colour on blue), a shadow and a
   slightly brighter image — no lift or zoom */
.bnr:hover {
  box-shadow: 0 0 0 2px var(--hover-cream), 0 18px 32px -18px rgba(10, 25, 45, .7);
}

.bnr:hover img {
  filter: brightness(1.06);
}

.bnr:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--hover-cream);
}

@media (prefers-reduced-motion: reduce) {
  .bnr,
  .bnr img {
    transition: none;
  }
}

/* --------------------------------------------------------------------------
   Responsive — tablets: the intro on its own row above the banners
   -------------------------------------------------------------------------- */
@media (max-width: 1100px) {
  /* banners no wider than ~420px (≈ 140px tall), like on wide screens */
  .bnr-box {
    grid-template-columns: repeat(2, minmax(0, 420px));
    justify-content: center;
  }

  .bnr-box__intro {
    grid-column: 1 / -1;
    padding: 4px 4px 0;
  }

  .bnr--wide {
    grid-column: 1 / -1;
  }
}

/* phones: the banners only, one under the other — no blue, no intro: the
   page's white with a light frame (as the white box before), the banners
   without the white ring */
@media (max-width: 640px) {
  .bnr-box {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--color-line);
    border-radius: 22px;
    background: var(--color-white);
    color: var(--color-navy-700);
  }

  .bnr-box::before,
  .bnr-box__intro {
    display: none;
  }

  .bnr {
    border-radius: 10px;
    background: var(--color-mist-200);
    color: var(--color-navy-700);
    box-shadow: none;
  }

  .bnr:hover {
    box-shadow: 0 0 0 2px var(--color-blue-300), 0 18px 32px -20px rgba(26, 43, 69, .45);
  }

  .bnr:hover img {
    filter: brightness(1.05);
  }

  .bnr:focus-visible {
    box-shadow: 0 0 0 3px var(--color-blue-500);
  }
}
