/* DJC ProductArray -- Skeleton
 *
 * Horizontal array of product columns (thumbnail + title + subtitle +
 * description + CTA). Two display modes:
 *
 *   .djc-product-array--inline  -> renders in place inside its host
 *   .djc-product-array--overlay -> full-screen overlay with a backdrop
 *
 * Structural layout only + skeleton defaults. All visual properties
 * are driven by --product-array-* CSS custom properties. The DJC skin
 * lives in /skins/productarray.djc.css.
 *
 * BEM parts:
 *   __overlay-bg          -- backdrop layer (overlay mode only)
 *   __overlay-close       -- close button (overlay mode)
 *   __inner               -- inner content container (z-index above backdrop)
 *   __heading             -- optional heading above the grid
 *   __grid                -- flex row of product columns
 *   __product             -- one product column
 *   __product-thumb       -- product thumbnail image
 *   __product-content     -- title + subtitle + description block
 *   __product-title       -- h3
 *   __product-subtitle    -- h4 (uppercase, accent color)
 *   __product-desc        -- body copy
 *   __product-cta-wrap    -- positioned wrapper for the CTA button
 *   __product-cta         -- the CTA button itself
 */

@import url('skins/productarray.djc.css');


.djc-product-array {
  /* colors */
  --product-array-bg: #444;
  --product-array-bg-image: none;
  --product-array-text: #fff;
  --product-array-title: #fff;
  --product-array-subtitle: #ffd28c;
  --product-array-desc: rgba(255, 255, 255, 0.92);
  --product-array-column-bg: rgba(255, 255, 255, 0.18);
  --product-array-column-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  --product-array-cta-bg: #c4501f;
  --product-array-cta-bg-hover: #a3411a;
  --product-array-cta-text: #fff;
  --product-array-close: #fff;
  --product-array-close-hover: #ffeac2;

  /* typography */
  --product-array-font: inherit;
  --product-array-heading-size: clamp(28px, 3vw, 40px);
  --product-array-title-size: clamp(20px, 1.6vw, 26px);
  --product-array-subtitle-size: 13px;
  --product-array-desc-size: 15px;
  --product-array-cta-size: 17px;

  /* spacing */
  --product-array-gap: 24px;
  /* column gap */
  --product-array-row-gap: 80px;
  /* clears thumb-above + CTA-below collisions when rows wrap */
  --product-array-grid-top-space: 64px;
  /* clearance between any heading above the grid and the row-1 thumbnails */
  --product-array-column-width: 244px;
  --product-array-column-height: 540px;
  --product-array-column-max-height: 720px;
  --product-array-column-padding: 0 18px 56px;
  --product-array-column-radius: 8px;
  --product-array-thumb-max-height: 140px;
  --product-array-thumb-max-width: 160px;
  --product-array-thumb-offset: -48px;
  /* pulls the thumbnail above the column */
  --product-array-content-margin: 100px;
  /* clears the floating thumbnail */
  --product-array-cta-bottom-offset: -20px;
  /* CTA sits half-out of column bottom */
  --product-array-cta-width: 210px;
  --product-array-cta-height: 42px;
  --product-array-cta-radius: 22px;

  /* description scroll cap -- prevents long lists from blowing out the
     column height. The desc gets its own internal scroll past this limit. */
  --product-array-desc-max-height: 240px;
  --product-array-scrollbar-width: 6px;
  --product-array-scrollbar-thumb: rgba(0, 0, 0, 0.25);

  /* overlay-only */
  --product-array-overlay-tint: rgba(40, 30, 20, 0.65);
  --product-array-overlay-padding: 56px 28px;
}


/* reset */
.djc-product-array *,
.djc-product-array *::before,
.djc-product-array *::after {
  box-sizing: border-box;
}


/* ============================================================
 * INLINE mode (also serves as the base structural layer)
 * ============================================================ */
.djc-product-array {
  display: block;
  width: 100%;
  color: var(--product-array-text);
  font-family: var(--product-array-font);
}

.djc-product-array__inner {
  display: flex;
  flex-direction: column;
  gap: 32px;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.djc-product-array__heading {
  margin: 0;
  font-size: var(--product-array-heading-size);
  line-height: 1.1;
  color: var(--product-array-title);
  text-align: center;
}

.djc-product-array__grid {
  display: flex;
  flex-wrap: wrap;
  /* row-gap is intentionally larger than column-gap: each card has a
     thumbnail floating ~48px above its top edge and a CTA floating ~20px
     below its bottom edge, so multi-row wraps need >68px between rows
     to keep row N's thumb from colliding with row N-1's CTA. */
  row-gap: var(--product-array-row-gap);
  column-gap: var(--product-array-gap);
  align-items: stretch;
  justify-content: center;
  /* clears the thumbnails on row 1 from whatever sits above the grid
     (typically the array heading). */
  padding-top: var(--product-array-grid-top-space);
}


/* ============================================================
 * Product column
 * ============================================================ */
.djc-product-array__product {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  width: var(--product-array-column-width);
  min-height: var(--product-array-column-height);
  max-height: var(--product-array-column-max-height);
  padding: var(--product-array-column-padding);
  background: var(--product-array-column-bg);
  border-radius: var(--product-array-column-radius);
  box-shadow: var(--product-array-column-shadow);
  text-align: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.djc-product-array__product-thumb {
  position: absolute;
  top: var(--product-array-thumb-offset);
  max-height: var(--product-array-thumb-max-height);
  max-width: var(--product-array-thumb-max-width);
  cursor: pointer;
  transition: transform 0.2s ease-in-out;
}

.djc-product-array__product-thumb:hover {
  transform: scale(1.05);
}

/* GIFT/donation thumb (text logo, no book) sits down inside the column instead of floating up */
.djc-product-array__product[data-product-code="GIFT"] .djc-product-array__product-thumb {
  position: relative;
  top: 20px;
  max-height: 90px;
}

.djc-product-array__product[data-product-code="GIFT"] .djc-product-array__product-content {
  margin-top: 30px;
}

.djc-product-array__product-content {
  margin-top: var(--product-array-content-margin);
  width: 100%;
  max-width: 250px;
}

.djc-product-array__product-title {
  margin: 20px auto;
  font-size: var(--product-array-title-size);
  line-height: 1.15;
  font-weight: 600;
  text-transform: none;
  color: var(--product-array-title);
}

.djc-product-array__product-subtitle {
  margin: 0 0 18px;
  font-size: var(--product-array-subtitle-size);
  letter-spacing: 0.25px;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--product-array-subtitle);
}

.djc-product-array__product-desc {
  width: 100%;
  max-height: var(--product-array-desc-max-height);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 8px;
  font-size: var(--product-array-desc-size);
  line-height: 1.35;
  text-align: left;
  color: var(--product-array-desc);
}

.djc-product-array__product-desc p {
  margin: 0 0 8px;
}

.djc-product-array__product-desc ul {
  padding-left: 20px;
  list-style: disc;
  margin: 0;
}

.djc-product-array__product-desc a {
  color: inherit;
  text-decoration: underline;
}

/* Custom scrollbar inside the descripton column so it reads as part of
   the card surface rather than a stark browser default */
.djc-product-array__product-desc::-webkit-scrollbar {
  width: var(--product-array-scrollbar-width);
}

.djc-product-array__product-desc::-webkit-scrollbar-track {
  background: transparent;
}

.djc-product-array__product-desc::-webkit-scrollbar-thumb {
  background: var(--product-array-scrollbar-thumb);
  border-radius: 3px;
}

.djc-product-array__product-cta-wrap {
  position: absolute;
  bottom: var(--product-array-cta-bottom-offset);
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
}

.djc-product-array__product-cta {
  appearance: none;
  border: 0;
  width: var(--product-array-cta-width);
  max-width: calc(100% - 40px);
  height: var(--product-array-cta-height);
  border-radius: var(--product-array-cta-radius);
  background: var(--product-array-cta-bg);
  color: var(--product-array-cta-text);
  font-size: var(--product-array-cta-size);
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  transition: background 0.2s ease, transform 0.2s ease;
}

.djc-product-array__product-cta:hover {
  background: var(--product-array-cta-bg-hover);
  transform: translateY(-1px);
}


/* ============================================================
 * OVERLAY mode
 * ============================================================ */
.djc-product-array--overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--product-array-overlay-padding);
  background: var(--product-array-bg);
  background-image: var(--product-array-bg-image);
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  overflow-y: auto;
  animation: djc-product-array-in 0.25s ease both;
}

.djc-product-array--closing {
  animation: djc-product-array-out 0.2s ease both;
}

@keyframes djc-product-array-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes djc-product-array-out {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

.djc-product-array--overlay .djc-product-array__overlay-bg {
  position: absolute;
  inset: 0;
  background: var(--product-array-overlay-tint);
  background-size: cover;
  background-position: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 0;
}

.djc-product-array--overlay .djc-product-array__inner {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  padding: 40px 0 20px;
}

.djc-product-array--overlay .djc-product-array__overlay-close {
  position: fixed;
  top: 22px;
  right: 30px;
  z-index: 2;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--product-array-close);
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.2s ease, color 0.2s ease;
}

.djc-product-array--overlay .djc-product-array__overlay-close:hover {
  color: var(--product-array-close-hover);
  transform: scale(1.1);
}

body.djc-product-array-open {
  overflow: hidden;
}


/* ============================================================
 * Responsive
 *
 * Desktop   >1100   : auto-wrap (5 across at typical 1280-1440 widths)
 * Laptop    <=1100  : 3 across
 * Tablet    <=820   : 2 across, descriptions hidden in overlay mode
 * Phone     <=560   : 1 column (vertical scroll)
 * ============================================================ */
@media (max-width: 1100px) {
  .djc-product-array__product {
    width: calc((100% / 3) - var(--product-array-gap) * 2 / 3);
    min-width: 220px;
  }
}

@media (max-width: 820px) {
  .djc-product-array--overlay {
    padding: 48px 20px;
  }

  .djc-product-array__product {
    width: calc(50% - var(--product-array-gap) / 2);
  }

  /* overlay: condense each column so 2-up fits a tablet height */
  .djc-product-array--overlay .djc-product-array__product {
    min-height: 320px;
    max-height: none;
    padding-bottom: 28px;
  }

  .djc-product-array--overlay .djc-product-array__product-desc {
    display: none;
  }

  .djc-product-array--overlay .djc-product-array__overlay-close {
    top: 14px;
    right: 16px;
    font-size: 28px;
  }
}

@media (max-width: 560px) {
  .djc-product-array--overlay {
    padding: 64px 16px 40px;
    align-items: flex-start;
  }

  .djc-product-array--overlay .djc-product-array__inner {
    padding: 0;
  }

  .djc-product-array__grid {
    row-gap: 64px;
    column-gap: 0;
    flex-direction: column;
    align-items: center;
  }

  .djc-product-array__product {
    width: 100%;
    max-width: 320px;
    min-width: 0;
    min-height: auto;
    padding: 0 18px 60px;
  }

  /* phone overlay: keep descriptions visible (the column padding gives
     it room) -- the cap on max-height plus inner scroll handles overflow */
  .djc-product-array--overlay .djc-product-array__product-desc {
    display: block;
    max-height: 160px;
  }

  .djc-product-array__heading {
    font-size: clamp(22px, 6vw, 28px);
    padding: 0 20px;
  }
}