/* ============================================================
   JAMMY PRODUCT PAGE

   Scope note: the Jammy shortcodes ([jammy-slider],
   [ticket_progress_split], [jammy_draw_info], [competition_tabs]) bring
   their own CSS. This file styles only the FRAME around them plus the
   WooCommerce elements we keep (gallery, price) — and overrides Woo's
   default stylesheet, which is where the purple buttons and olive prices
   come from.
   ============================================================ */

.jam-product {
  /* Narrower than the global --wrap (1340px). At full width the two columns
     stretch far enough apart that the buy box loses its relationship to the
     prize image. Tune --wrap-product in style.css. */
  max-width: var(--wrap-product);
  margin: 0 auto;
}

/* ---- Conditional strips above everything (ticket count / results) ---- */
.jam-p-pre { margin-bottom: 22px; }

/* ============================================================
   TWO COLUMNS
   ============================================================ */

.jam-p-top {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
  margin-bottom: 34px;
}

.jam-p-media { min-width: 0; }
.jam-p-buy { min-width: 0; }

/* ---- Title ---- */
.jam-p-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(26px, 3.2vw, 40px);
  line-height: 1.12;
  color: var(--jam-red);
  text-shadow: 0 3px 0 var(--jam-red-deep), 0 0 22px rgba(227, 36, 59, .22);
  letter-spacing: .5px;
  margin: 0 0 18px;
}

/* ---- Price ----
   Woo wraps the price in <p class="price"> with <span class="woocommerce-Price-amount">.
   Its own stylesheet colours this olive-green, so we override explicitly. */
.jam-p-price-label {
  font-weight: 700;
  font-size: 17px;
  color: var(--ink);
  margin: 0 0 6px;
}

.jam-p-price .price,
.jam-p-price .woocommerce-Price-amount {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(30px, 3.6vw, 44px);
  color: var(--jam-red);
  text-shadow: 0 3px 0 var(--jam-red-deep);
  letter-spacing: 1px;
  margin: 0;
  line-height: 1.1;
  display: block;
}
/* Woo prints a <del>/<ins> pair when a sale price is set. */
.jam-p-price del { opacity: .45; font-size: .6em; }
.jam-p-price ins { text-decoration: none; }

.jam-p-slider { margin-top: 20px; }

/* ---- Postal entry ----
   A free entry route is a legal requirement for UK prize competitions, so
   this link is deliberately prominent rather than buried. */
.jam-p-postal {
  text-align: center;
  font-weight: 700;
  font-size: 15px;
  margin: 22px 0 0;
  color: var(--ink);
}
.jam-p-postal a {
  color: var(--jam-red);
  font-weight: 800;
  text-decoration: none;
  border-bottom: 2px solid rgba(227, 36, 59, .35);
  transition: border-color .18s;
}
.jam-p-postal a:hover { border-bottom-color: var(--jam-red); }

/* ============================================================
   GALLERY

   Our own markup (inc/product-gallery.php), not WooCommerce's. Woo's
   depends on flexslider, which wasn't initialising here — thumbnails were
   dead and images fell back to a ragged static grid. Owning the markup means
   the thumbnail row can be its own scroll container, which is what allows a
   single row with arrows rather than wrapping.

   No !important anywhere in this block, because there's no Woo gallery CSS
   left to fight.
   ============================================================ */

.jam-gal {
  background: var(--white);
  border-radius: var(--card-r);
  box-shadow: var(--shadow-card);
  padding: 10px;
  overflow: hidden;
}

/* ---- Main image ---- */
.jam-gal-main { position: relative; }

.jam-gal-img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: calc(var(--card-r) - 4px);
  cursor: zoom-in;
}

.jam-gal-zoom {
  position: absolute;
  top: 12px; right: 12px;
  z-index: 5;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--white);
  box-shadow: 0 3px 12px rgba(0, 0, 0, .18);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  line-height: 1;
  transition: transform .18s var(--spring);
}
.jam-gal-zoom:hover { transform: scale(1.08); }

/* ============================================================
   THUMBNAIL STRIP

   One row, always. The <ul> is the scroll container; arrows sit outside it
   so they don't scroll away. scroll-snap makes arrow steps land cleanly on
   a thumbnail rather than mid-image.
   ============================================================ */

.jam-gal-strip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: var(--thumb-gap);
}

.jam-gal-thumbs {
  list-style: none;
  margin: 0;
  padding: 2px 0 6px;
  display: flex;
  gap: var(--thumb-gap);
  flex: 1;
  min-width: 0;

  /* The bit that matters: one row, scroll instead of wrap. */
  flex-wrap: nowrap;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;

  /* Hide the scrollbar — the arrows are the affordance. Still scrollable by
     trackpad, wheel-tilt and touch. */
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.jam-gal-thumbs::-webkit-scrollbar { display: none; }

.jam-gal-thumbs li { flex: 0 0 auto; margin: 0; scroll-snap-align: start; }

.jam-gal-thumb {
  display: block;
  width: var(--thumb-size);
  height: var(--thumb-size);
  padding: 0;
  border: 2px solid transparent;
  border-radius: 10px;
  overflow: hidden;
  background: #f0f0f3;
  cursor: pointer;
  opacity: .6;
  transition: opacity .18s, border-color .18s, transform .18s;
}
.jam-gal-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  /* Crops mismatched aspect ratios to a uniform square. */
  object-fit: cover;
}
.jam-gal-thumb:hover { opacity: 1; transform: translateY(-2px); }
.jam-gal-thumb.is-active {
  opacity: 1;
  border-color: var(--jam-red);
}

/* ---- Arrows ---- */
.jam-gal-arrow {
  flex: 0 0 auto;
  width: 30px;
  height: var(--thumb-size);
  border: none;
  border-radius: 9px;
  background: #f0f0f3;
  color: var(--jam-red);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .18s, opacity .18s;
}
.jam-gal-arrow:hover { background: #e4e4e9; }
.jam-gal-arrow:disabled { opacity: .3; cursor: default; }
.jam-gal-arrow[hidden] { display: none; }

/* ============================================================
   LIGHTBOX
   ============================================================ */

body.jam-lb-open { overflow: hidden; }

.jam-lb {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(12, 12, 14, .92);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 40px 64px;
}
.jam-lb.is-open { display: flex; }

.jam-lb-img {
  max-width: 100%;
  max-height: 100%;
  display: block;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
}

.jam-lb-close,
.jam-lb-nav {
  position: absolute;
  border: none;
  background: rgba(255, 255, 255, .12);
  color: var(--white);
  cursor: pointer;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background .18s, transform .18s;
}
.jam-lb-close:hover,
.jam-lb-nav:hover { background: rgba(255, 255, 255, .26); }

.jam-lb-close {
  top: 18px; right: 18px;
  width: 46px; height: 46px;
  font-size: 26px;
  line-height: 1;
}

.jam-lb-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 50px; height: 50px;
  font-size: 30px;
  line-height: 1;
}
.jam-lb-nav:hover { transform: translateY(-50%) scale(1.06); }
.jam-lb-prev { left: 14px; }
.jam-lb-next { right: 14px; }
.jam-lb-nav[hidden] { display: none; }

/* ============================================================
   FULL-WIDTH BLOCKS
   ============================================================ */

.jam-p-trust { margin: 0 0 26px; display: flex; justify-content: center; }
.jam-p-progress { margin-bottom: 22px; }
.jam-p-draw { margin-bottom: 22px; }
.jam-p-tabs { margin-bottom: 26px; }

/* ============================================================
   GLI BANNER
   ============================================================ */

.jam-gli-banner {
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--ink);
  border-radius: var(--card-r);
  padding: 14px 18px;
  max-width: 680px;
  margin: 0 auto 32px;
  text-decoration: none;
  transition: transform .18s var(--spring), box-shadow .18s;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .18);
}
.jam-gli-banner:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .26);
}

/* White container because the supplied badge is a JPG — see footer.css. */
.jam-gli-banner-badge {
  background: var(--white);
  border-radius: 8px;
  padding: 6px 8px;
  flex-shrink: 0;
  line-height: 0;
}
.jam-gli-banner-badge img { height: 52px; width: auto; display: block; }

.jam-gli-banner-txt { flex: 1; min-width: 0; }
.jam-gli-banner-txt b {
  display: block;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 16px;
  color: var(--cream);
  letter-spacing: .4px;
  line-height: 1.2;
}
.jam-gli-banner-txt span {
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, .55);
  letter-spacing: .3px;
}

.jam-gli-banner-cta {
  background: var(--jam-grad);
  color: var(--cream);
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: .5px;
  padding: 10px 18px;
  border-radius: var(--pill);
  box-shadow: 0 3px 0 var(--jam-red-deep);
  flex-shrink: 0;
  white-space: nowrap;
}

/* ============================================================
   MORE COMPETITIONS

   Full-bleed grey band. Uses the 100vw trick to break out of .jam-wrap.
   ============================================================ */

.jam-p-more {
  background: #ebebef;
  padding: 34px 0 40px;
  margin: 40px calc(50% - 50vw) 0;
  width: 100vw;
}
.jam-p-more-in { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }

.jam-p-more h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(22px, 3vw, 32px);
  color: var(--jam-red);
  text-shadow: 0 3px 0 var(--jam-red-deep);
  text-align: center;
  margin: 0 0 26px;
  letter-spacing: .5px;
}

/* Woo's [products] loop markup */
.jam-p-more ul.products {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.jam-p-more ul.products::before,
.jam-p-more ul.products::after { display: none; }

.jam-p-more ul.products li.product {
  width: auto;
  margin: 0;
  float: none;
  background: var(--white);
  border-radius: var(--card-r);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform .18s, box-shadow .18s;
}
.jam-p-more ul.products li.product:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .12);
}
.jam-p-more ul.products li.product a { text-decoration: none; }
.jam-p-more ul.products li.product img { display: block; width: 100%; height: auto; margin: 0; }

.jam-p-more ul.products li.product .woocommerce-loop-product__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 14px;
  color: var(--jam-red);
  padding: 12px 12px 6px;
  margin: 0;
  line-height: 1.25;
  letter-spacing: .3px;
}
.jam-p-more ul.products li.product .price {
  display: block;
  padding: 0 12px 12px;
  font-weight: 800;
  font-size: 14px;
  color: var(--jam-red);
}
.jam-p-more ul.products li.product .price del { opacity: .45; font-weight: 600; }
.jam-p-more ul.products li.product .price ins { text-decoration: none; }

/* Woo's loop add-to-cart button — restyled from its default purple. */
.jam-p-more ul.products li.product .button {
  display: block;
  margin: 0 12px 12px;
  background: var(--jam-grad);
  color: var(--cream);
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: .4px;
  text-align: center;
  padding: 10px 14px;
  border-radius: var(--pill);
  box-shadow: 0 3px 0 var(--jam-red-deep);
  border: none;
  transition: transform .16s var(--spring), box-shadow .16s;
}
.jam-p-more ul.products li.product .button:hover { color: var(--cream); }
.jam-p-more ul.products li.product .button:active {
  transform: translateY(3px);
  box-shadow: 0 0 0 var(--jam-red-deep);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1080px) {
  .jam-p-more ul.products { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  /*
   * Single column. Gallery first, then the buy box.
   *
   * Worth knowing: on a phone this pushes the entry form below the fold,
   * because the gallery takes most of the first screen. If conversion data
   * says that's costing you, the fix is `order: -1` on .jam-p-buy to put
   * the picker above the gallery — but that hides the prize image, which is
   * the thing that sells. Left as-is deliberately; flagged for testing.
   */
  .jam-p-top {
    grid-template-columns: 1fr;
    gap: 24px;
    margin-bottom: 26px;
  }
  .jam-p-title { font-size: clamp(23px, 6vw, 30px); }
}

@media (max-width: 640px) {
  .jam-p-more ul.products { grid-template-columns: 1fr 1fr; gap: 14px; }
  .jam-p-more { padding: 26px 0 30px; }
  .jam-p-more h2 { font-size: 21px; margin-bottom: 18px; }
  .jam-p-more ul.products li.product .woocommerce-loop-product__title { font-size: 12.5px; }

  .jam-gli-banner {
    flex-direction: column;
    text-align: center;
    gap: 12px;
    padding: 16px;
  }
  .jam-gli-banner-badge img { height: 44px; }

  .jam-p-postal { font-size: 14px; }
  .jam-p-price-label { font-size: 15px; }

  /* Four per row on a ~390px phone. */
  .jam-p-media { --thumb-size: 68px; --thumb-gap: 7px; }
}

@media (prefers-reduced-motion: reduce) {
  .jam-gli-banner,
  .jam-p-more ul.products li.product,
  .jam-p-media .woocommerce-product-gallery__trigger { transition: none; }
}
