/* PoeticKarma grid layout — auto-emitted by src/lib/page-builder/grid/grid.css.ts */

/* ── Grid container ─────────────────────────────────────────────────── */
/* Sizing fixes:
   - grid-auto-rows: auto (was minmax(220px,auto)) — let content drive height,
     individual blocks set their own min-height when they need one.
   - Grid is centered with the same max-width the chrome uses (1280px to match
     pk-topnav / pk-footer inner widths) so the page content does NOT appear
     left-shifted with whitespace on the right. */
.pk-grid {
  display: grid;
  grid-template-columns: repeat(var(--pk-grid-cols, 3), minmax(0, 1fr));
  grid-auto-rows: auto;
  gap: var(--pk-space-4, 16px);
  width: 100%;
  max-width: var(--pk-container-max, 1500px); /* matches pk-nav__top-inner / pk-nav__sub-inner */
  margin: 0 auto;
  padding: var(--pk-space-4, 16px);
  box-sizing: border-box;
}

/* On narrow viewports, collapse to a single column and reset spans so
   each block stretches across the full width. Reading order = layout
   order via sortBlocksReadingOrder() in renderers.ts. */
@media (max-width: 767px) {
  .pk-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
  }
  .pk-grid > .pk-grid-cell {
    grid-column: 1 / -1 !important;
    grid-row: auto !important;
  }
}

.pk-grid-cell {
  min-width: 0; /* prevent overflow inside grid items */
  display: flex;
  flex-direction: column;
}

.pk-grid-cell > * {
  flex: 1 1 auto;
  min-height: 0;
}

/* ── Hero carousel ──────────────────────────────────────────────────── */
/* Sizing fix: lock hero to a 16:9 aspect ratio with a hard max-height so a
   tall product image (e.g. portrait jersey) cannot blow the row up to
   thousands of pixels. object-fit: contain on the image keeps the full
   product visible without cropping. */
.pk-hero-carousel {
  position: relative;
  overflow: hidden;
  border-radius: var(--pk-radius-md, 12px);
  background: var(--pk-bg-muted, #f5f5f5);
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 480px;
  min-height: 240px;
}
.pk-hero-carousel__track {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  height: 100%;
  scroll-snap-type: x mandatory;
  overflow-x: auto;
}
.pk-hero-carousel__slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  position: relative;
  height: 100%;
}
.pk-hero-carousel__link {
  display: block;
  height: 100%;
  position: relative;
  text-decoration: none;
  color: inherit;
}
.pk-hero-carousel__image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--pk-bg-muted, #f5f5f5);
  display: block;
}
.pk-hero-carousel__caption {
  position: absolute;
  inset: auto 0 0 0;
  padding: var(--pk-space-4, 16px);
  background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
  color: #fff;
}
.pk-hero-carousel__title { font-size: var(--pk-fs-xl, 1.5rem); margin: 0 0 .25em; }
.pk-hero-carousel__price { font-size: var(--pk-fs-lg, 1.125rem); margin: 0 0 .5em; opacity: .9; }
.pk-hero-carousel__arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(0,0,0,0.5); color: #fff;
  border: none; width: 40px; height: 40px; border-radius: 50%;
  font-size: 1.5rem; cursor: pointer; z-index: 2;
}
.pk-hero-carousel__arrow--prev { left: 12px; }
.pk-hero-carousel__arrow--next { right: 12px; }
.pk-hero-carousel__dots {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 6px; z-index: 2;
}
.pk-hero-carousel__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255,255,255,0.5); border: none; cursor: pointer;
}
.pk-hero-carousel__dot[aria-selected="true"] { background: #fff; }

/* ── Hero static ────────────────────────────────────────────────────── */
.pk-hero-static {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 480px;
  min-height: 240px;
  border-radius: var(--pk-radius-md, 12px);
  overflow: hidden;
  background-image: var(--pk-hero-image, none);
  background-size: cover;
  background-position: center;
  background-color: var(--pk-bg-muted, #f5f5f5);
}
.pk-hero-static__overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0, var(--pk-hero-overlay, 0));
}
.pk-hero-static__content {
  position: relative;
  padding: var(--pk-space-6, 24px);
  max-width: 600px;
  color: #fff;
  z-index: 1;
}
.pk-hero-static--align-left   .pk-hero-static__content { margin-right: auto; text-align: left; }
.pk-hero-static--align-center .pk-hero-static__content { margin: 0 auto; text-align: center; }
.pk-hero-static--align-right  .pk-hero-static__content { margin-left: auto; text-align: right; }
.pk-hero-static__headline { font-size: var(--pk-fs-2xl, 2rem); margin: 0 0 .25em; }
.pk-hero-static__subheadline { font-size: var(--pk-fs-lg, 1.125rem); margin: 0 0 1em; opacity: .95; }

/* ── Product grid (inside a block) ──────────────────────────────────── */
.pk-product-grid { width: 100%; }
.pk-grid-heading,
.pk-product-grid > .pk-grid-heading,
.pk-ranking__heading,
.pk-categories__heading,
.pk-faq__heading,
.pk-newsletter__heading,
.pk-carousel__title {
  font-size: var(--pk-fs-xl, 1.5rem);
  margin: 0 0 var(--pk-space-3, 12px);
  color: var(--pk-text-strong, #111);
}
.pk-product-grid__items {
  display: grid;
  gap: var(--pk-space-3, 12px);
}
.pk-product-grid--cols-2 .pk-product-grid__items { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pk-product-grid--cols-3 .pk-product-grid__items { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pk-product-grid--cols-4 .pk-product-grid__items { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 767px) {
  .pk-product-grid__items { grid-template-columns: 1fr 1fr !important; }
}

/* ── Ranking ────────────────────────────────────────────────────────── */
.pk-ranking__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--pk-space-3, 12px); }
.pk-ranking__item { display: flex; gap: var(--pk-space-3, 12px); align-items: center; }
.pk-ranking__rank {
  flex: 0 0 auto;
  font-size: var(--pk-fs-2xl, 2rem); font-weight: 700;
  color: var(--pk-color-primary, #0070f3); min-width: 2.5em; text-align: center;
}
.pk-ranking__card { flex: 1 1 auto; min-width: 0; }

/* ── Heading ────────────────────────────────────────────────────────── */
.pk-heading { padding: var(--pk-space-2, 8px) 0; }
.pk-heading--align-left   { text-align: left; }
.pk-heading--align-center { text-align: center; }
.pk-heading--align-right  { text-align: right; }
.pk-heading__eyebrow {
  display: block;
  font-size: var(--pk-fs-sm, .875rem);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--pk-color-primary, #0070f3);
  margin-bottom: .25em;
}
.pk-heading__text { margin: 0; color: var(--pk-text-strong, #111); }

/* ── Rich text ──────────────────────────────────────────────────────── */
.pk-richtext {
  font-size: var(--pk-fs-base, 1rem);
  line-height: 1.6;
  color: var(--pk-text, #333);
}
.pk-richtext h2 { font-size: var(--pk-fs-xl, 1.5rem); margin: 1.2em 0 .4em; }
.pk-richtext h3 { font-size: var(--pk-fs-lg, 1.125rem); margin: 1em 0 .4em; }
.pk-richtext p  { margin: 0 0 1em; }
.pk-richtext ul, .pk-richtext ol { margin: 0 0 1em 1.5em; }
.pk-richtext a  { color: var(--pk-color-primary, #0070f3); text-decoration: underline; }
.pk-richtext blockquote {
  border-left: 3px solid var(--pk-color-primary, #0070f3);
  padding-left: var(--pk-space-3, 12px);
  margin: 1em 0; color: var(--pk-text-muted, #666); font-style: italic;
}

/* ── FAQ ────────────────────────────────────────────────────────────── */
.pk-faq__items { display: flex; flex-direction: column; gap: var(--pk-space-2, 8px); }
.pk-faq__item {
  border: 1px solid var(--pk-border, #e5e5e5);
  border-radius: var(--pk-radius-sm, 8px);
  padding: var(--pk-space-3, 12px) var(--pk-space-4, 16px);
  background: var(--pk-bg, #fff);
}
.pk-faq__q { font-weight: 600; cursor: pointer; }
.pk-faq__a { margin-top: var(--pk-space-2, 8px); color: var(--pk-text, #333); }

/* ── Newsletter ─────────────────────────────────────────────────────── */
.pk-newsletter {
  background: var(--pk-bg-muted, #f5f5f5);
  padding: var(--pk-space-5, 20px);
  border-radius: var(--pk-radius-md, 12px);
  text-align: center;
}
.pk-newsletter__form {
  display: flex; gap: var(--pk-space-2, 8px);
  max-width: 480px; margin: var(--pk-space-3, 12px) auto 0;
}
.pk-newsletter__input {
  flex: 1 1 auto; min-width: 0;
  padding: var(--pk-space-2, 8px) var(--pk-space-3, 12px);
  border: 1px solid var(--pk-border, #e5e5e5); border-radius: var(--pk-radius-sm, 8px);
  font-size: var(--pk-fs-base, 1rem);
}
.pk-newsletter__btn { flex: 0 0 auto; }
@media (max-width: 480px) {
  .pk-newsletter__form { flex-direction: column; }
}

/* ── Category tiles ─────────────────────────────────────────────────── */
.pk-categories__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--pk-space-3, 12px);
}
.pk-categories__tile {
  display: flex; flex-direction: column; align-items: center;
  text-decoration: none; color: var(--pk-text-strong, #111);
  border-radius: var(--pk-radius-sm, 8px); overflow: hidden;
  background: var(--pk-bg-muted, #f5f5f5);
  transition: transform .15s ease;
}
.pk-categories__tile:hover { transform: translateY(-2px); }
.pk-categories__image {
  width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block;
}
.pk-categories__image--placeholder { background: var(--pk-bg-muted-2, #e5e5e5); }
.pk-categories__label {
  padding: var(--pk-space-2, 8px); text-align: center; font-weight: 600;
}

/* ── Empty AdZone collapse ──────────────────────────────────────────── */
/* If the ad-decision pipeline has not (yet) injected a creative, the slot
   is an empty <aside data-pk-ad-zone="..."></aside>. Collapse the entire
   grid cell so it doesn't reserve a row of dead space. The cell is hidden
   only when the AdZone block has no rendered child content. */
.pk-grid-cell--adzone:has(> .pk-ad:empty) {
  display: none !important;
}
/* Fallback for browsers without :has() — at least don't reserve a min-height. */
.pk-grid-cell--adzone .pk-ad:empty {
  min-height: 0;
}

/* ── Main wrapper width alignment ───────────────────────────────────── */
/* The chrome (header/footer) and the grid both need to sit in the same
   visual column. Without this, the grid is centered at 1280px but the
   page chrome is full-width, so on 1920px screens the content appears
   shifted to the left with empty space on the right. */
.pk-main--grid {
  width: 100%;
  display: block;
}

/* ── Affiliate disclosure ───────────────────────────────────────────── */
.pk-affiliate-disclosure {
  font-size: var(--pk-fs-sm, .875rem);
  color: var(--pk-text-muted, #666);
  padding: var(--pk-space-3, 12px);
  border-top: 1px solid var(--pk-border, #e5e5e5);
  text-align: center;
}

/* ── Placeholder for empty/missing data blocks ──────────────────────── */
.pk-block-placeholder {
  display: flex; align-items: center; justify-content: center;
  height: 100%; min-height: 120px;
  border: 1px dashed var(--pk-border, #ccc); border-radius: var(--pk-radius-sm, 8px);
  background: var(--pk-bg-muted, #f5f5f5);
  color: var(--pk-text-muted, #666); font-size: var(--pk-fs-sm, .875rem);
  padding: var(--pk-space-3, 12px); text-align: center;
}

/* ── Screen-reader helper ───────────────────────────────────────────── */
.pk-sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ── Featured product (detail variant) ──────────────────────────────── */
/* Side-by-side image gallery + body on desktop, stacked on mobile.
   This is the full product-page treatment used by the system-default
   product layout above the review body. */
.pk-product-detail {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: var(--pk-space-6, 24px);
  background: var(--pk-bg, #fff);
  padding: var(--pk-space-5, 20px);
  border-radius: var(--pk-radius-md, 12px);
  border: 1px solid var(--pk-border, #e5e5e5);
}
.pk-product-detail__media { position: relative; }
.pk-product-detail__hero-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: var(--pk-bg-muted, #f5f5f5);
  border-radius: var(--pk-radius-sm, 8px);
  display: block;
}
.pk-product-detail__hero-image--placeholder { background: var(--pk-bg-muted-2, #e5e5e5); }
.pk-product-detail__thumbs {
  display: flex; flex-wrap: wrap; gap: var(--pk-space-2, 8px);
  list-style: none; margin: var(--pk-space-3, 12px) 0 0; padding: 0;
}
.pk-product-detail__thumb {
  width: 60px; height: 60px; padding: 0; border: 1px solid var(--pk-border, #e5e5e5);
  border-radius: var(--pk-radius-xs, 4px); background: var(--pk-bg-muted, #f5f5f5);
  cursor: pointer; overflow: hidden;
}
.pk-product-detail__thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.pk-product-detail__deal {
  position: absolute; top: var(--pk-space-3, 12px); left: var(--pk-space-3, 12px);
  background: var(--pk-color-danger, #cc0c39); color: #fff;
  padding: 2px 8px; border-radius: var(--pk-radius-xs, 4px);
  font-size: var(--pk-fs-sm, .875rem); font-weight: 700;
}
.pk-product-detail__brand {
  font-size: var(--pk-fs-sm, .875rem); color: var(--pk-color-primary, #007185);
  margin: 0 0 .25em;
}
.pk-product-detail__title {
  font-size: var(--pk-fs-2xl, 1.75rem);
  margin: 0 0 .35em; color: var(--pk-text-strong, #111); line-height: 1.25;
}
.pk-product-detail__ratings {
  font-size: var(--pk-fs-sm, .875rem); color: var(--pk-text-muted, #666);
  margin: 0 0 .5em;
}
.pk-product-detail__price {
  font-size: var(--pk-fs-xl, 1.5rem); font-weight: 700;
  color: var(--pk-text-strong, #111); margin: 0 0 .75em;
}
.pk-product-detail__features-heading,
.pk-product-detail__description-heading {
  font-size: var(--pk-fs-lg, 1.125rem); margin: 1em 0 .4em;
  color: var(--pk-text-strong, #111);
}
.pk-product-detail__features { margin: 0 0 var(--pk-space-4, 16px) 1.25em; padding: 0; }
.pk-product-detail__features li { margin-bottom: .35em; line-height: 1.5; }
.pk-product-detail__cta {
  display: inline-block;
  padding: var(--pk-space-3, 12px) var(--pk-space-5, 20px);
  font-size: var(--pk-fs-base, 1rem); font-weight: 700;
  margin: var(--pk-space-2, 8px) 0;
}
.pk-product-detail__description { margin-top: var(--pk-space-4, 16px); }
.pk-product-detail__description p { margin: 0 0 .8em; line-height: 1.6; }
@media (max-width: 767px) {
  .pk-product-detail { grid-template-columns: 1fr; }
}

/* ── Review body (Wattson / human-edited review HTML) ───────────────── */
.pk-review-body {
  background: var(--pk-bg, #fff);
  padding: var(--pk-space-5, 20px);
  border-radius: var(--pk-radius-md, 12px);
  border: 1px solid var(--pk-border, #e5e5e5);
}
.pk-review-body__heading {
  font-size: var(--pk-fs-xl, 1.5rem);
  margin: 0 0 var(--pk-space-3, 12px);
  color: var(--pk-text-strong, #111);
}
.pk-review-body__content {
  font-size: var(--pk-fs-base, 1rem);
  line-height: 1.65;
  color: var(--pk-text, #333);
}
.pk-review-body__content h1,
.pk-review-body__content h2 { font-size: var(--pk-fs-xl, 1.5rem); margin: 1.2em 0 .4em; color: var(--pk-text-strong, #111); }
.pk-review-body__content h3 { font-size: var(--pk-fs-lg, 1.125rem); margin: 1em 0 .4em; color: var(--pk-text-strong, #111); }
.pk-review-body__content p  { margin: 0 0 1em; }
.pk-review-body__content ul,
.pk-review-body__content ol { margin: 0 0 1em 1.5em; }
.pk-review-body__content li { margin-bottom: .35em; }
.pk-review-body__content a  { color: var(--pk-color-primary, #007185); text-decoration: underline; }
.pk-review-body__content blockquote {
  border-left: 3px solid var(--pk-color-primary, #007185);
  padding-left: var(--pk-space-3, 12px);
  margin: 1em 0; color: var(--pk-text-muted, #666); font-style: italic;
}
.pk-review-body__content img {
  max-width: 100%; height: auto;
  border-radius: var(--pk-radius-sm, 8px);
  margin: 1em 0;
}
.pk-review-body__content hr {
  border: none; border-top: 1px solid var(--pk-border, #e5e5e5);
  margin: 1.5em 0;
}
