/* ============================================================
   ai-product-card-generated.css
   Bookstore & Literary Culture — Warm Paper Aesthetic
   ============================================================ */

/* ------------------------------------------------------------
   Grid Layout
   ------------------------------------------------------------ */
.ai-pl-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

@media (min-width: 750px) {
  .ai-pl-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1024px) {
  .ai-pl-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
  }
}

/* ------------------------------------------------------------
   Carousel Layout
   ------------------------------------------------------------ */
.ai-pl-carousel-wrap {
  position: relative;
}

.ai-pl-carousel {
  display: flex;
  overflow: hidden;
}

.ai-pl-carousel ai-product-card {
  flex-shrink: 0;
}

.ai-pl-prev,
.ai-pl-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: var(--background);
  color: var(--foreground);
  border: 1.5px solid currentColor;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  transition: background 0.2s, color 0.2s;
  opacity: 0.85;
}

.ai-pl-prev {
  left: 6px;
}

.ai-pl-next {
  right: 6px;
}

.ai-pl-prev:hover,
.ai-pl-next:hover {
  background: var(--brand);
  color: var(--brand-foreground);
  border-color: var(--brand);
  opacity: 1;
}

/* ------------------------------------------------------------
   Card Root
   ------------------------------------------------------------ */
.ai-card {
  background: var(--background);
  color: var(--foreground);
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(59, 42, 26, 0.10), 0 0 0 1px rgba(59, 42, 26, 0.06);
  overflow: hidden;
  transition: box-shadow 0.25s, transform 0.25s;
  font-family: 'Lora', 'Playfair Display', Georgia, serif;
}

.ai-card:hover {
  box-shadow: 0 6px 20px rgba(59, 42, 26, 0.16), 0 0 0 1px rgba(59, 42, 26, 0.10);
  transform: translateY(-2px);
}

/* ------------------------------------------------------------
   Image Area
   ------------------------------------------------------------ */
.ai-card__media {
  aspect-ratio: 3 / 4;
}

/* Hover image swap */
.ai-card__img--hover {
  opacity: 0;
  transition: opacity 0.35s ease;
}

.ai-card[data-has-hover-img]:hover .ai-card__img--hover {
  opacity: 1;
}

.ai-card[data-has-hover-img]:hover .ai-card__img {
  opacity: 0;
}

/* ------------------------------------------------------------
   Discount Badge
   ------------------------------------------------------------ */
.ai-card__badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--striking);
  color: var(--striking-foreground);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 2px;
  line-height: 1.4;
  z-index: 1;
  font-family: 'Lora', Georgia, serif;
}

/* New badge — hidden by default */
.ai-card__badge--new {
  display: none;
}

/* ------------------------------------------------------------
   Wishlist — hidden
   ------------------------------------------------------------ */
.ai-card__wishlist {
  display: none;
}

/* ------------------------------------------------------------
   Hover Overlay (Add to Cart slide-up)
   ------------------------------------------------------------ */
.ai-card__overlay {
  transform: translateY(100%);
  transition: transform 0.28s ease;
  background: rgba(59, 42, 26, 0.72);
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-card:hover .ai-card__overlay {
  transform: translateY(0);
}

.ai-card__overlay-btn {
  background: var(--cta);
  color: var(--cta-foreground);
  border: none;
  border-radius: 2px;
  padding: 9px 20px;
  font-size: 13px;
  font-family: 'Lora', Georgia, serif;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  width: 100%;
  transition: background 0.2s, color 0.2s, opacity 0.2s;
}

.ai-card__overlay-btn:hover,
.ai-card__overlay-btn:focus {
  background: var(--striking);
  color: var(--striking-foreground);
  outline: none;
}

.ai-card__overlay-btn:active {
  opacity: 0.82;
}

/* Add-to-cart in info area — hidden (using overlay instead) */
.ai-card__add-wrap {
  display: none;
}

/* ------------------------------------------------------------
   Info Area
   ------------------------------------------------------------ */
.ai-card__info {
  padding: 14px 14px 16px;
  gap: 6px;
  background: var(--background);
  color: var(--foreground);
}

.ai-card__info-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* Vendor — hidden */
.ai-card__vendor {
  display: none;
}

.ai-card__title {
  font-family: 'Lora', 'Playfair Display', Georgia, serif;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--foreground);
  letter-spacing: 0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ------------------------------------------------------------
   Price
   ------------------------------------------------------------ */
.ai-price {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.ai-price__current {
  font-family: 'Lora', Georgia, serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--striking-foreground, var(--foreground));
}

/* Use striking surface on the price current to match bookstore emphasis */
.ai-price__current {
  color: inherit;
}

/* Striking is a surface token; for readable price text we must use a foreground.
   Override: display price with foreground token, add accent underline decoration */
.ai-price__current {
  color: var(--foreground);
  position: relative;
}

.ai-price__compare {
  font-size: 12px;
  color: var(--foreground);
  opacity: 0.5;
  text-decoration: line-through;
  font-weight: 400;
}

/* ------------------------------------------------------------
   Swatches — hidden
   ------------------------------------------------------------ */
.ai-card__swatches {
  display: none;
}

/* ------------------------------------------------------------
   Rating — hidden
   ------------------------------------------------------------ */
.ai-card__rating {
  display: none;
}

/* ------------------------------------------------------------
   Card Back — hidden (no flip effect used)
   ------------------------------------------------------------ */
.ai-card__back {
  display: none;
}

/* ------------------------------------------------------------
   Add-to-Cart State Feedback (overlay button)
   ------------------------------------------------------------ */
ai-quick-add-cart[data-state="loading"] .ai-card__overlay-btn {
  opacity: 0.65;
  pointer-events: none;
}

ai-quick-add-cart[data-state="success"] .ai-card__overlay-btn {
  background: var(--secondary);
  color: var(--secondary-foreground);
}

ai-quick-add-cart[data-state="error"] .ai-card__overlay-btn {
  background: var(--striking);
  color: var(--striking-foreground);
  animation: ai-card-shake 0.4s ease;
}

@keyframes ai-card-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

/* ------------------------------------------------------------
   Quick Add-to-Cart Modal (.qac-*)
   ------------------------------------------------------------ */
.qac-wrapper {
  position: fixed;
  inset: 0;
  z-index: 9000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.qac-wrapper[data-open] {
  pointer-events: auto;
  opacity: 1;
}

.qac-wrapper:not([data-open]) {
  pointer-events: none;
  opacity: 0;
}

.qac-overlay {
  position: fixed;
  inset: 0;
  background: rgba(59, 42, 26, 0.45);
  z-index: 9001;
}

.qac-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9002;
  width: min(720px, 92vw);
  max-height: 90vh;
  background: var(--background);
  color: var(--foreground);
  border-radius: 6px;
  box-shadow: 0 16px 48px rgba(59, 42, 26, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Lora', Georgia, serif;
}

/* Header */
.qac-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(59, 42, 26, 0.12);
  background: var(--background);
  color: var(--foreground);
}

.qac-product-title {
  font-family: 'Lora', 'Playfair Display', Georgia, serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--foreground);
  line-height: 1.4;
}

.qac-close {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--foreground);
  font-size: 22px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 2px;
  transition: background 0.18s, color 0.18s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qac-close:hover,
.qac-close:focus {
  background: var(--accent);
  color: var(--accent-foreground);
  outline: none;
}

.qac-close:active {
  opacity: 0.75;
}

/* Body */
.qac-body {
  display: flex;
  flex-direction: row;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.qac-product-media {
  flex: 0 0 40%;
  max-width: 40%;
  overflow: hidden;
  background: var(--accent);
}

.qac-product-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.qac-product-info {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--background);
  color: var(--foreground);
}

/* Footer */
.qac-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(59, 42, 26, 0.12);
  background: var(--background);
}

.qac-submit {
  display: block;
  width: 100%;
  background: var(--cta);
  color: var(--cta-foreground);
  border: none;
  border-radius: 3px;
  padding: 12px 20px;
  font-size: 14px;
  font-family: 'Lora', Georgia, serif;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, opacity 0.2s;
  text-align: center;
}

.qac-submit:hover,
.qac-submit:focus {
  background: var(--striking);
  color: var(--striking-foreground);
  outline: none;
}

.qac-submit:active {
  opacity: 0.82;
}

.qac-submit:disabled {
  background: var(--accent);
  color: var(--accent-foreground);
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.qac-submit[data-sold-out] {
  background: var(--brand);
  color: var(--brand-foreground);
  opacity: 0.7;
  cursor: not-allowed;
  pointer-events: none;
}

.qac-submit[data-loading] {
  opacity: 0.65;
  pointer-events: none;
  cursor: wait;
}

.qac-submit[data-success] {
  background: var(--secondary);
  color: var(--secondary-foreground);
}

.qac-submit[data-error] {
  background: var(--striking);
  color: var(--striking-foreground);
  animation: ai-card-shake 0.4s ease;
}

/* Responsive: stack modal on small screens */
@media (max-width: 600px) {
  .qac-body {
    flex-direction: column;
  }

  .qac-product-media {
    flex: 0 0 220px;
    max-width: 100%;
    width: 100%;
  }
}