/*
 * Single Product — Child Theme CSS
 * File: yourchildtheme/css/single-product.css
 *
 * Load in functions.php:
 *   add_action('wp_enqueue_scripts', function(){
 *       if(is_product()){
 *           wp_enqueue_style('sp-style',
 *               get_stylesheet_directory_uri().'/css/single-product.css', [], '1.0.0');
 *       }
 *   });
 */

/* ════════════════════════════════════════
   VARIABLES  (match exact colours from design)
════════════════════════════════════════ */
:root {
  --sp-ink:        #1a1208;
  --sp-parchment:  #faf6ef;
  --sp-cream:      #f3ece0;
  --sp-amber:      #c8842a;
  --sp-amber-lt:   #e8a84a;
  --sp-amber-pale: #fdf3e3;
  --sp-rust:       #9c4a1a;
  --sp-sage:       #5a6e5a;
  --sp-muted:      #7a6e5e;
  --sp-border:     #e0d5c5;
  --sp-shadow:     rgba(26,18,8,0.10);
  --sp-radius:     4px;
}

/* ════════════════════════════════════════
   WRAPPER
════════════════════════════════════════ */
.sp-wrap {
  color: var(--sp-ink);
  font-size: 15px;
  line-height: 1.6;
  background: var(--sp-parchment);
}

/* ════════════════════════════════════════
   SECTION 1 — PRODUCT HERO
════════════════════════════════════════ */
.sp-product-section {
  max-width: 1180px;
  margin: 0 auto;
  padding: 52px 40px 60px;
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 60px;
  align-items: start;
}

/* ── LEFT: Book Visual ── */
.sp-book-visual {
  position: sticky;
  top: 82px;
}

/* Real product image */
.sp-book-frame {
  width: 100%;
  border-radius: var(--sp-radius);
  overflow: hidden;
  box-shadow: 4px 8px 40px rgba(26,18,8,0.30), 1px 3px 8px rgba(26,18,8,0.15);
  background: var(--sp-cream);
}
.sp-book-real-img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform .35s ease;
}

/* ── PDF Ribbon ── */
.sp-pdf-ribbon {
  background: var(--sp-amber);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
  text-align: center;
  padding: 8px 14px;
  border-radius: var(--sp-radius) var(--sp-radius) 0 0;
  letter-spacing: .01em;
}

/* frame gets no top-radius when ribbon sits above */
.sp-book-frame--has-pdf {
  border-radius: 0 0 var(--sp-radius) var(--sp-radius) !important;
}

/* ── Clickable image link wrapper ── */
.sp-pdf-img-link {
  display: block;
  position: relative;
  overflow: hidden;
  text-decoration: none;
}
.sp-pdf-img-link:hover .sp-book-real-img,
.sp-pdf-img-link:hover .sp-book-cover-art { transform: scale(1.03); }
.sp-pdf-img-link:hover .sp-pdf-hover-overlay { opacity: 1; }

/* ── Hover overlay ── */
.sp-pdf-hover-overlay {
  position: absolute;
  inset: 0;
  background: rgba(26, 18, 8, 0.58);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .25s ease;
  pointer-events: none;
}
.sp-pdf-overlay-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.sp-pdf-overlay-inner svg {
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.5));
}
.sp-pdf-overlay-inner span {
  background: var(--sp-amber);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 8px 22px;
  border-radius: 2px;
}

/* Decorative placeholder cover (no image) */
.sp-book-frame--art {
  position: relative;
  padding-bottom: 142%;
  background: linear-gradient(135deg, #2d4a6b, #1a2d42);
  border-radius: 2px 10px 10px 2px;
  box-shadow: -6px 0 0 #111 inset, 4px 8px 40px rgba(26,18,8,0.35), 1px 3px 8px rgba(26,18,8,0.2);
}
.sp-book-frame--art::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 28px;
  background: linear-gradient(to right, #0a1520, #1a2d42);
  border-right: 1px solid rgba(255,255,255,0.06);
  z-index: 1;
}
.sp-book-cover-art {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 36px 24px 24px 44px;
  text-align: center;
}
.sp-stars-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(200,132,42,.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(90,110,90,.12) 0%, transparent 40%);
}
.sp-cover-icon {
  position: relative;
  font-size: 54px;
  margin-bottom: 20px;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,.4));
}
.sp-cover-title {
  position: relative;
  font-size: 28px;
  font-style: italic;
  color: #e8d5b0;
  line-height: 1.25;
  margin-bottom: 18px;
  text-shadow: 0 2px 8px rgba(0,0,0,.5);
}
.sp-cover-divider {
  position: relative;
  width: 60px; height: 1px;
  background: var(--sp-amber);
  margin: 0 auto 18px;
}
.sp-cover-author {
  position: relative;
  color: #a89070;
  font-size: 13px;
  letter-spacing: .12em;
  text-transform: uppercase;
}

/* Gallery thumbnails */
.sp-gallery-thumbs {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.sp-thumb {
  width: 62px; height: 80px;
  border: 2px solid var(--sp-border);
  border-radius: var(--sp-radius);
  overflow: hidden;
  cursor: pointer;
  background: var(--sp-cream);
  transition: border-color .18s;
}
.sp-thumb img { width:100%; height:100%; object-fit:cover; display:block; }
.sp-thumb:hover, .sp-thumb--active { border-color: var(--sp-amber); }

/* Badges under image */
.sp-book-badges {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.sp-badge {
  padding: 5px 12px;
  border-radius: 2px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: .05em;
}
.sp-badge--amber { background: var(--sp-amber); color: #fff; }
.sp-badge--sage  { background: var(--sp-sage);  color: #fff; }
.sp-badge--rust  { background: var(--sp-rust);  color: #fff; }

/* ── RIGHT: Product Info ── */
.sp-product-genre {
  font-size: 11.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--sp-amber);
  font-weight: 600;
  margin-bottom: 10px;
}
.sp-product-genre a { color: inherit; text-decoration: none; }
.sp-product-genre a:hover { text-decoration: underline; }

.sp-product-title {
  font-size: 36px;
  font-weight: 700;
  line-height: 1.18;
  color: var(--sp-ink);
  margin: 0 0 6px;
}

.sp-product-subtitle {
  font-style: italic;
  font-size: 18px;
  color: var(--sp-muted);
  margin-bottom: 22px;
}

/* Stars row */
.sp-review-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 26px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--sp-border);
}
.sp-stars { font-size: 17px; letter-spacing: 2px; line-height: 1; }
.sp-stars i      { font-style: normal; color: var(--sp-amber); }
.sp-stars i.half { color: var(--sp-amber-lt); }
.sp-stars i.off  { color: #ccc; }
.sp-review-score { font-weight: 700; font-size: 15px; }
.sp-review-count { color: var(--sp-muted); font-size: 13px; }
.sp-review-divider { width: 1px; height: 16px; background: var(--sp-border); }
.sp-review-link {
  color: var(--sp-amber);
  font-size: 13px;
  text-decoration: none;
  border-bottom: 1px dashed var(--sp-amber-lt);
}
.sp-review-link:hover { border-bottom-style: solid; }

/* Price — override WooCommerce output */
.sp-price-block {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.sp-price-block .price,
.sp-price-block .woocommerce-Price-amount { font-size: 38px !important; font-weight: 700 !important; color: var(--sp-rust) !important; font-style: normal !important; }
.sp-price-block del .woocommerce-Price-amount { font-size: 20px !important; color: var(--sp-muted) !important; font-weight: 400 !important; }
.sp-price-block ins { text-decoration: none !important; background: none !important; }

.sp-price-save {
  background: #fde8d0;
  color: var(--sp-rust);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 2px;
  letter-spacing: .05em;
  align-self: center;
}

/* Info table */
.sp-info-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 26px;
  font-size: 13.5px;
}
.sp-info-table tr { border-bottom: 1px solid var(--sp-border); }
.sp-info-table tr:last-child { border-bottom: none; }
.sp-info-table td { padding: 10px 0; vertical-align: top; }
.sp-info-table td:first-child {
  color: var(--sp-muted);
  font-weight: 500;
  width: 145px;
  letter-spacing: .02em;
}
.sp-info-table a { color: var(--sp-amber); text-decoration: none; }
.sp-info-table a:hover { text-decoration: underline; }
.sp-tag {
  display: inline-block;
  background: var(--sp-cream);
  border: 1px solid var(--sp-border);
  padding: 2px 9px;
  border-radius: 2px;
  font-size: 12px;
  margin: 1px 2px 1px 0;
  color: var(--sp-ink);
}

/* Stock */
.sp-stock-bar {
  background: var(--sp-cream);
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius);
  padding: 14px 18px;
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.sp-stock-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #4caf7a;
  box-shadow: 0 0 0 3px rgba(76,175,122,.2);
  flex-shrink: 0;
}
.sp-stock--low .sp-stock-dot { background: #e8a030; box-shadow: 0 0 0 3px rgba(232,160,48,.2); }
.sp-stock--out .sp-stock-dot { background: #d04030; box-shadow: 0 0 0 3px rgba(208,64,48,.2); }
.sp-stock-text { font-size: 13.5px; }
.sp-stock--in  .sp-stock-text strong { color: var(--sp-sage); }
.sp-stock--low .sp-stock-text strong { color: #b87020; }
.sp-stock--out .sp-stock-text strong { color: var(--sp-rust); }

/* Quantity */
.sp-qty-section { margin-bottom: 22px; }
.sp-qty-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--sp-muted);
  margin-bottom: 10px;
}
.sp-qty-control {
  display: inline-flex;
  align-items: stretch;
  border: 1.5px solid var(--sp-border);
  border-radius: var(--sp-radius);
  overflow: hidden;
  background: #fff;
}
.sp-qty-btn {
  width: 44px; height: 44px;
  background: var(--sp-cream);
  border: none;
  font-size: 20px;
  font-weight: 300;
  cursor: pointer;
  color: var(--sp-ink);
  transition: background .15s;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.sp-qty-btn:hover { background: var(--sp-border); }
.sp-qty-input {
  width: 58px;
  border: none;
  border-left: 1.5px solid var(--sp-border);
  border-right: 1.5px solid var(--sp-border);
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  background: #fff;
  color: var(--sp-ink);
  outline: none;
  -moz-appearance: textfield;
}
.sp-qty-input::-webkit-inner-spin-button,
.sp-qty-input::-webkit-outer-spin-button { -webkit-appearance: none; }

/* CTA Buttons */
.sp-cta-row {
  display: flex;
  gap: 14px;
  margin-bottom: 22px;
}

/* Add to Cart */
.sp-btn-cart {
  flex: 1;
  padding: 14px 20px;
  background: var(--sp-ink);
  color: var(--sp-parchment);
  border: 2px solid var(--sp-ink);
  border-radius: var(--sp-radius);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .2s, transform .15s;
  font-family: inherit;
}
.sp-btn-cart:hover:not(:disabled) { background: #2e2010; transform: translateY(-1px); }
.sp-btn-cart:disabled { opacity: .6; cursor: not-allowed; }
.sp-btn-cart.sp-btn-cart--loading .sp-btn-cart-label::before {
  content: '';
  display: inline-block;
  width: 13px; height: 13px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: sp-spin .7s linear infinite;
  margin-right: 6px;
  vertical-align: middle;
}
.sp-btn-cart--success { background: #2e6b3a !important; border-color: #2e6b3a !important; }

/* Buy Now */
.sp-btn-buy {
  flex: 1;
  padding: 14px 20px;
  background: var(--sp-amber);
  color: #fff;
  border: 2px solid var(--sp-amber);
  border-radius: var(--sp-radius);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .2s, border-color .2s, transform .15s;
  font-family: inherit;
}
.sp-btn-buy:hover:not(:disabled) { background: var(--sp-rust); border-color: var(--sp-rust); transform: translateY(-1px); }
.sp-btn-buy:disabled { opacity: .6; cursor: not-allowed; }
.sp-btn-buy svg { flex-shrink: 0; }

/* Wishlist / Share row */
.sp-wishlist-row {
  display: flex;
  gap: 18px;
  font-size: 13px;
  margin-top: 4px;
}
.sp-wl-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--sp-muted);
  font-size: 13px;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  transition: color .2s;
}
.sp-wl-btn:hover { color: var(--sp-amber); }

/* Toast */
.sp-toast {
  margin-top: 14px;
  font-size: 13.5px;
  font-weight: 600;
  padding: 0;
  height: 0;
  overflow: hidden;
  border-radius: var(--sp-radius);
  transition: all .25s;
}
.sp-toast.sp-toast--show {
  padding: 11px 16px;
  height: auto;
}
.sp-toast--ok  { background: #edf8f0; color: #1e6b3a; border: 1px solid #b0dfc0; }
.sp-toast--err { background: #fef0ee; color: var(--sp-rust);  border: 1px solid #f0b8a8; }

@keyframes sp-spin { to { transform: rotate(360deg); } }

/* ════════════════════════════════════════
   SECTION 2 — TABS
════════════════════════════════════════ */
.sp-tabs-section {
  background: #fff;
  border-top: 1px solid var(--sp-border);
  border-bottom: 1px solid var(--sp-border);
}
.sp-tabs-nav {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 40px;
  display: flex;
  border-bottom: 2px solid var(--sp-border);
}
.sp-tab-btn {
  background: none;
  border: none;
  padding: 20px 28px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--sp-muted);
  cursor: pointer;
  position: relative;
  transition: color .2s;
  font-family: inherit;
}
.sp-tab-btn:hover { color: var(--sp-ink); }
.sp-tab-btn--active { color: var(--sp-ink); }
.sp-tab-btn--active::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0; right: 0;
  height: 2px;
  background: var(--sp-amber);
}
.sp-tab-content {
  max-width: 1180px;
  margin: 0 auto;
  padding: 48px 40px 56px;
}
.sp-tab-panel { display: none; }
.sp-tab-panel--active { display: block; }

/* Description */
.sp-desc-lead {
  font-style: italic;
  font-size: 20px;
  color: var(--sp-ink);
  margin-bottom: 22px;
  line-height: 1.55;
  max-width: 760px;
  border-left: 3px solid var(--sp-amber);
  padding-left: 22px;
}
.sp-desc-body {
  max-width: 760px;
  color: #3a2e1e;
  line-height: 1.8;
  font-size: 15.5px;
}
.sp-desc-body p + p { margin-top: 16px; }

/* Hide WC reviews title (inside our tab) */
#sp-tab-reviews .woocommerce-Reviews-title { display: none !important; }

/* ════════════════════════════════════════
   SEPARATOR
════════════════════════════════════════ */
.sp-separator {
  height: 1px;
  background: var(--sp-border);
  max-width: 1180px;
  margin: 0 auto;
}

/* ════════════════════════════════════════
   SECTION 3 — RELATED PRODUCTS
════════════════════════════════════════ */
.sp-related-section {
  max-width: 1180px;
  margin: 0 auto;
  padding: 56px 40px 72px;
}
.sp-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 36px;
}
.sp-section-title { font-size: 26px; font-weight: 700; color: var(--sp-ink); margin: 0; }
.sp-section-title span { font-style: italic; font-weight: 400; color: var(--sp-amber); }
.sp-section-link {
  font-size: 13px;
  color: var(--sp-amber);
  text-decoration: none;
  border-bottom: 1px dashed var(--sp-amber-lt);
  font-weight: 500;
}
.sp-section-link:hover { border-bottom-style: solid; }

.sp-products-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 22px;
}

.sp-product-card {
  background: #fff;
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius);
  overflow: hidden;
  transition: transform .25s, box-shadow .25s;
}
.sp-product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 36px var(--sp-shadow);
}
.sp-product-card:hover .sp-card-overlay { opacity: 1; }

.sp-card-img {
  width: 100%;
  aspect-ratio: 2/3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  position: relative;
  overflow: hidden;
}
.sp-card-overlay {
  position: absolute; inset: 0;
  background: rgba(26,18,8,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .2s;
}
.sp-overlay-btn {
  background: var(--sp-amber);
  color: #fff;
  border: none;
  padding: 9px 18px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  border-radius: 2px;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s;
}
.sp-overlay-btn:hover { background: var(--sp-rust); }
.sp-overlay-btn.sp-btn--loading { opacity: .7; pointer-events: none; }
.sp-overlay-btn.sp-btn--done { background: #2e6b3a; }

.sp-card-body { padding: 14px 14px 16px; }
.sp-card-genre { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--sp-amber); font-weight: 600; margin-bottom: 5px; }
.sp-card-title { font-size: 14.5px; font-weight: 700; line-height: 1.35; color: var(--sp-ink); margin-bottom: 4px; }
.sp-card-title a { color: inherit; text-decoration: none; }
.sp-card-title a:hover { color: var(--sp-amber); }
.sp-card-author { font-size: 12px; color: var(--sp-muted); margin-bottom: 10px; }
.sp-card-footer { display: flex; align-items: center; justify-content: space-between; }
.sp-card-price .woocommerce-Price-amount { font-weight: 700; font-size: 15px; color: var(--sp-rust); }
.sp-card-stars { font-size: 11px; color: var(--sp-amber); }

/* Card colour gradients */
.sp-bg-1 { background: linear-gradient(145deg,#1e3a5f,#2d5a8e); }
.sp-bg-2 { background: linear-gradient(145deg,#3b1f14,#6b3a22); }
.sp-bg-3 { background: linear-gradient(145deg,#1e3b2f,#2e6b4f); }
.sp-bg-4 { background: linear-gradient(145deg,#3b1a3a,#6b2e68); }
.sp-bg-5 { background: linear-gradient(145deg,#2e2a1a,#5a4e28); }

/* ════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════ */
@media (max-width: 1024px) {
  .sp-products-grid { grid-template-columns: repeat(3, 1fr); }
  .sp-products-grid .sp-product-card:nth-child(4),
  .sp-products-grid .sp-product-card:nth-child(5) { display: none; }
}

@media (max-width: 860px) {
  .sp-product-section {
    grid-template-columns: 1fr;
    gap: 36px;
    padding: 32px 24px 48px;
  }
  .sp-book-visual { position: static; max-width: 300px; margin: 0 auto; }
  .sp-tabs-nav { padding: 0 24px; }
  .sp-tab-content { padding: 36px 24px 48px; }
  .sp-related-section { padding: 40px 24px 56px; }
  .sp-cta-row { flex-direction: column; }
}

@media (max-width: 640px) {
  .sp-products-grid { grid-template-columns: 1fr; }
  .sp-products-grid .sp-product-card:nth-child(2),
  .sp-products-grid .sp-product-card:nth-child(3) { display: none; }
  .sp-product-title { font-size: 28px; }
  .sp-price-block .price,
  .sp-price-block .woocommerce-Price-amount { font-size: 30px !important; }
  .sp-tab-btn { padding: 16px; font-size: 12px; }
  .sp-section-title { font-size: 22px; }
}