/* Amazon Affiliate Product Box V3 — external, theme-safe component styles. */
.aapb-products,
.aapb-comparison,
.aapb-fallback {
  --aapb-accent: #ff9900;
  --aapb-accent-strong: #e47911;
  --aapb-ink: #172235;
  --aapb-muted: #5d6878;
  --aapb-border: #dce2ea;
  --aapb-surface: #fff;
  --aapb-soft: #f6f8fb;
  --aapb-focus: #1769aa;
  clear: both;
  box-sizing: border-box;
  margin-block: 2rem;
  color: var(--aapb-ink);
  font: inherit;
}

.aapb-products *,
.aapb-comparison * {
  box-sizing: border-box;
}

.aapb-products__heading {
  margin: 0 0 1rem;
  color: var(--aapb-ink);
  font-size: clamp(1.25rem, 2.5vw, 1.65rem);
  line-height: 1.25;
}

.aapb-products__items {
  display: grid;
  gap: 1.25rem;
}

.aapb-products--grid .aapb-products__items {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
}

.aapb-products--style-light .aapb-product {
  background: #fff;
  box-shadow: none;
}

.aapb-products--style-dark {
  --aapb-ink: #f7f8fa;
  --aapb-muted: #c6ced8;
  --aapb-border: #3b4656;
  --aapb-surface: #202938;
  --aapb-soft: #293445;
}

.aapb-product {
  position: relative;
  display: grid;
  grid-template-columns: minmax(8rem, 11rem) minmax(0, 1fr);
  gap: clamp(1rem, 3vw, 1.75rem);
  align-items: center;
  min-width: 0;
  padding: clamp(1rem, 3vw, 1.5rem);
  overflow: hidden;
  border: 1px solid var(--aapb-border);
  border-radius: 1rem;
  background: linear-gradient(135deg, var(--aapb-surface), var(--aapb-soft));
  box-shadow: 0 0.5rem 1.6rem rgb(23 34 53 / 8%);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.aapb-product:hover {
  border-color: #bbc5d2;
  box-shadow: 0 0.8rem 2rem rgb(23 34 53 / 13%);
  transform: translateY(-2px);
}

.aapb-product__media {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 0.75rem;
  background: #fff;
}

.aapb-product__media img {
  position: static;
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
}

.aapb-product--editorial-media .aapb-product__media img {
  object-fit: cover;
}

.aapb-product a::after {
  display: none !important;
  content: none !important;
}

.aapb-product__media--empty {
  border: 1px dashed var(--aapb-border);
  background:
    linear-gradient(135deg, transparent 46%, #e4e9f0 47% 53%, transparent 54%),
    var(--aapb-soft);
}

.aapb-product__content {
  min-width: 0;
}

.aapb-product__title {
  margin: 0 0 0.75rem;
  color: var(--aapb-ink);
  font-size: clamp(1.05rem, 2.3vw, 1.35rem);
  font-weight: 750;
  line-height: 1.35;
}

.aapb-product__title a {
  color: inherit;
  text-decoration: none;
}

.aapb-product__title a:hover {
  text-decoration: underline;
  text-decoration-thickness: 0.09em;
  text-underline-offset: 0.15em;
}

.aapb-product__description {
  margin-block: 0 1rem;
  color: var(--aapb-muted);
  font-size: 0.96rem;
  line-height: 1.6;
}

.aapb-product__description > :first-child {
  margin-top: 0;
}

.aapb-product__description > :last-child {
  margin-bottom: 0;
}

.aapb-product__ribbon {
  position: absolute;
  z-index: 1;
  inset: 0 auto auto 0;
  display: grid;
  place-items: center;
  min-width: 2.2rem;
  min-height: 2.2rem;
  border-radius: 0 0 0.75rem;
  background: var(--aapb-accent);
  color: #111;
  font-weight: 800;
}

.aapb-price {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.65rem;
  align-items: baseline;
  margin-block: 0.75rem 1rem;
}

.aapb-price strong {
  color: #a23a00;
  font-size: 1.2rem;
}

.aapb-products--style-dark .aapb-price strong {
  color: #ffbd72;
}

.aapb-price small {
  flex-basis: 100%;
  color: var(--aapb-muted);
  font-size: 0.75rem;
  line-height: 1.4;
}

.aapb-price--unavailable {
  color: var(--aapb-muted);
  font-size: 0.9rem;
}

.aapb-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.7rem 1.15rem;
  border: 1px solid #c66f00;
  border-radius: 999px;
  background: linear-gradient(#ffb84d, var(--aapb-accent));
  color: #1a1308 !important;
  font-weight: 750;
  line-height: 1.2;
  text-align: center;
  text-decoration: none !important;
  box-shadow: 0 0.22rem 0.6rem rgb(136 78 0 / 18%);
  transition: background-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.aapb-button:hover {
  background: linear-gradient(#ffc461, #f3a014);
  box-shadow: 0 0.35rem 0.8rem rgb(136 78 0 / 28%);
  transform: translateY(-1px);
}

.aapb-button--compact {
  min-height: 2.4rem;
  padding: 0.55rem 0.85rem;
  font-size: 0.88rem;
}

.aapb-product a:focus-visible,
.aapb-button:focus-visible,
.aapb-table a:focus-visible,
.aapb-table-scroll:focus-visible,
.aapb-fallback a:focus-visible {
  outline: 3px solid var(--aapb-focus);
  outline-offset: 3px;
}

.aapb-disclosure {
  margin: 0.75rem 0 0;
  color: var(--aapb-muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

.aapb-fallback {
  margin-block: 1.25rem;
  padding: 1rem;
  border: 1px solid var(--aapb-border);
  border-radius: 0.75rem;
  background: var(--aapb-soft);
}

.aapb-fallback small {
  display: block;
  margin-top: 0.35rem;
  color: var(--aapb-muted);
}

.aapb-table-scroll {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  border: 1px solid var(--aapb-border);
  border-radius: 0.9rem;
  background: var(--aapb-surface);
  box-shadow: 0 0.5rem 1.5rem rgb(23 34 53 / 7%);
}

.aapb-table {
  width: 100%;
  min-width: 42rem;
  margin: 0;
  border: 0;
  border-collapse: collapse;
  color: var(--aapb-ink);
  background: var(--aapb-surface);
  table-layout: fixed;
}

.aapb-table caption {
  padding: 1rem;
  color: var(--aapb-ink);
  font-size: 1.15rem;
  font-weight: 750;
  text-align: left;
}

.aapb-table th,
.aapb-table td {
  padding: 0.9rem;
  border: 1px solid var(--aapb-border);
  vertical-align: middle;
  text-align: center;
}

.aapb-table thead th,
.aapb-table tbody th {
  background: var(--aapb-soft);
}

.aapb-table .aapb-table__featured {
  background: color-mix(in srgb, var(--aapb-accent) 12%, var(--aapb-surface));
}

.aapb-table tbody th {
  width: 10rem;
  text-align: left;
}

.aapb-table__label-column {
  width: 10rem;
}

.aapb-table__product {
  display: grid;
  gap: 0.65rem;
  justify-items: center;
}

.aapb-table__product a {
  color: var(--aapb-ink);
  font-weight: 700;
  text-decoration: none;
}

.aapb-table__image {
  display: block;
  width: 8rem;
  height: 8rem;
  object-fit: contain;
}

@media (max-width: 680px) {
  .aapb-product {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .aapb-product__media {
    width: min(14rem, 72vw);
    margin-inline: auto;
  }

  .aapb-button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .aapb-product,
  .aapb-button {
    transition: none;
  }

  .aapb-product:hover,
  .aapb-button:hover {
    transform: none;
  }
}

@media (forced-colors: active) {
  .aapb-product,
  .aapb-table-scroll,
  .aapb-button {
    border: 1px solid CanvasText;
  }
}
