/* ==========================================================================
   ร้านค้า /special — คอร์ส หนังสือ ไพ่ & วัตถุมงคลสายขาว (ย้ายมาจากหน้า /sp)
   โหลดคู่กับ special.css (ธีมหลัก ink + gold)
   ========================================================================== */

.sp-shop { border-bottom: 1px solid var(--line); }
.sp-guarantees {
  max-width: 980px; margin: 0 auto clamp(26px, 3vw, 40px);
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px;
}
.sp-guarantee {
  display: flex; gap: 12px; align-items: flex-start;
  border: 1px solid var(--line); border-radius: 12px; background: #100e0c; padding: 14px 16px;
}
.sp-guarantee-ic {
  display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px;
  border-radius: 10px; border: 1px solid rgba(217, 164, 78, .45); color: var(--gold-2); font-size: 1rem;
}
.sp-guarantee b { display: block; font-size: .86rem; font-weight: 500; }
.sp-guarantee small { color: var(--muted); font-size: .78rem; line-height: 1.5; }

.sp-shop-filters {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
  margin: 0 auto clamp(24px, 3vw, 36px);
}
.sp-filter {
  appearance: none; cursor: pointer; font: inherit; font-size: .84rem;
  background: #14110f; border: 1px solid #2f2822; color: var(--muted);
  border-radius: 30px; padding: 8px 16px; transition: all .2s;
}
.sp-filter:hover { border-color: var(--gold); color: var(--gold-2); }
.sp-filter.is-on { background: var(--gold); border-color: var(--gold); color: #1a1206; font-weight: 600; }

.sp-shop-grid .sp-product { padding: 0 0 22px; overflow: hidden; display: flex; flex-direction: column; }
.sp-product[hidden] { display: none; }
.sp-product-art {
  position: relative; min-height: 150px; padding: 16px 18px 18px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 10px;
  background:
    radial-gradient(ellipse at 88% 110%, rgba(217, 164, 78, .28), transparent 62%),
    linear-gradient(160deg, #1a1714, #0d0b0a);
  border-bottom: 1px solid var(--line);
}
.sp-product-white {
  position: absolute; top: 12px; right: 12px;
  font-size: .66rem; letter-spacing: .06em; color: var(--gold-2);
  border: 1px solid rgba(217, 164, 78, .35); border-radius: 20px; padding: 2px 9px;
  background: rgba(11, 10, 9, .75);
}
/* ในกล่อง modal ป้ายนี้อยู่ในการไหลปกติ ไม่ลอยไปทับปุ่มปิด */
.sp-modal-top .sp-product-white { position: static; display: inline-block; margin-bottom: 6px; }
.sp-product-mark {
  display: grid; place-items: center; width: 46px; height: 46px; margin-top: 26px;
  border-radius: 12px; border: 1px solid rgba(217, 164, 78, .45);
  background: rgba(11, 10, 9, .7); color: var(--gold-2); font-size: 1.4rem;
}
.sp-product-heading { position: relative; }
.sp-product-cat { font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); }
.sp-product-heading h3 { font-size: 1.02rem; line-height: 1.4; margin: 3px 0 0; color: var(--cream); }
.sp-product .card-body { display: flex; flex-direction: column; gap: 0; padding: 18px 22px 0; flex: 1; }
.sp-product-sub { font-size: .8rem !important; color: var(--gold-2) !important; margin: 0 0 8px !important; }
.sp-product-desc {
  font-size: .88rem !important; color: #cfc5b7 !important; margin: 0 0 14px !important;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.sp-product .sp-price-row { margin-top: auto; }
.sp-product .sp-duration { max-width: 46%; }
.sp-product-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.sp-product-actions .btn { padding: 9px 8px; font-size: .8rem; }

/* ---------- modal ---------- */
body.sp-modal-open, body.sp-cart-open { overflow: hidden; }
.sp-modal { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 16px; }
.sp-modal[hidden] { display: none; }
.sp-modal-backdrop { position: absolute; inset: 0; background: rgba(6, 5, 4, .82); backdrop-filter: blur(3px); }
.sp-modal-box {
  position: relative; width: min(720px, 100%); max-height: 88vh; overflow: hidden;
  display: flex; flex-direction: column;
  background: linear-gradient(170deg, #1a1714, #100e0c);
  border: 1px solid rgba(217, 164, 78, .4); border-radius: var(--radius);
  box-shadow: 0 30px 70px -30px #000;
}
.sp-modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--line); background: #0d0b0a;
}
.sp-modal-head span { font-size: .76rem; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); }
.sp-modal-close {
  appearance: none; background: #14110f; border: 1px solid #33291f; color: var(--muted);
  width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: .85rem; line-height: 1;
}
.sp-modal-close:hover { border-color: var(--gold); color: var(--gold-2); }
.sp-modal-body { padding: 20px; overflow-y: auto; }
.sp-modal-top { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 16px; }
.sp-modal-art {
  display: grid; place-items: center; width: 96px; height: 96px; flex: 0 0 96px;
  border-radius: 14px; border: 1px solid rgba(217, 164, 78, .45);
  background: #0d0b0a; color: var(--gold-2); font-size: 2rem;
}
.sp-modal-top h3 { font-size: 1.15rem; margin: 6px 0; }
.sp-modal-top .sp-price { margin: 0 0 4px; }
.sp-modal-stock { font-size: .78rem; color: #9ed07f; margin: 0; }
.sp-modal-detail {
  border: 1px solid #2a231c; border-radius: 10px; background: #0f0d0c; padding: 14px 16px; margin-bottom: 14px;
}
.sp-modal-detail h4 { font-size: .82rem; color: var(--gold-2); margin: 0 0 6px; font-family: var(--font-body); font-weight: 600; }
.sp-modal-detail .sp-body { margin: 0; }
.sp-modal-detail .sp-hint { margin: 8px 0 0; padding-top: 8px; border-top: 1px solid #241f1a; }
.sp-modal-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 8px; }

/* ---------- cart drawer ---------- */
.sp-cart-backdrop { position: fixed; inset: 0; z-index: 85; background: rgba(6, 5, 4, .72); backdrop-filter: blur(2px); }
.sp-cart-backdrop[hidden] { display: none; }
.sp-cart {
  position: fixed; top: 0; right: 0; z-index: 90; height: 100%; width: min(430px, 100%);
  display: flex; flex-direction: column;
  background: #0f0d0c; border-left: 1px solid rgba(217, 164, 78, .35);
  transform: translateX(102%); transition: transform .3s ease;
  box-shadow: -24px 0 60px -30px #000;
}
.sp-cart.is-open { transform: none; }
.sp-cart-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid var(--line); background: #0b0a09;
}
.sp-cart-head b { display: block; font-family: var(--font-head); font-size: .98rem; font-weight: 500; color: var(--gold-2); }
.sp-cart-head small { color: var(--muted); font-size: .76rem; }
.sp-cart-body { flex: 1; overflow-y: auto; padding: 16px 18px 24px; }
.sp-cart-empty { text-align: center; padding: 24px 8px; color: var(--muted); }
.sp-cart-empty p { margin: 4px 0; }
.sp-cart-empty b { color: var(--text); font-weight: 500; }
.sp-cart-items { display: grid; gap: 10px; }
.sp-cart-item { border: 1px solid #2a231c; border-radius: 10px; background: #14110f; padding: 12px; }
.sp-cart-item-head { display: flex; justify-content: space-between; gap: 10px; }
.sp-cart-item-head b { font-size: .86rem; font-weight: 500; line-height: 1.4; }
.sp-cart-item-head span { color: var(--gold-2); font-size: .86rem; white-space: nowrap; }
.sp-cart-item-meta { margin: 6px 0 0; font-size: .76rem; color: var(--muted); }
.sp-cart-item-note {
  margin: 6px 0 0; font-size: .74rem; color: #ddd4c6;
  border: 1px solid #2a231c; border-radius: 6px; padding: 4px 8px; background: #0d0b0a;
}
.sp-cart-item-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.sp-cart-item-foot small { color: #8d8377; font-size: .72rem; }
.sp-cart-qty { display: inline-flex; align-items: center; gap: 4px; border: 1px solid #33291f; border-radius: 8px; padding: 2px 4px; }
.sp-cart-qty button {
  appearance: none; background: none; border: 0; color: var(--muted); font: inherit; font-size: .95rem;
  width: 22px; height: 22px; cursor: pointer; line-height: 1;
}
.sp-cart-qty button:hover { color: var(--gold-2); }
.sp-cart-qty span { min-width: 16px; text-align: center; font-size: .82rem; }
.sp-cart-form { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.sp-cart-form[hidden] { display: none; }
.sp-cart-form h4 { font-size: .9rem; margin: 0 0 12px; color: var(--gold-2); font-family: var(--font-body); font-weight: 600; }
.sp-cart-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.sp-cart-total {
  display: flex; align-items: center; justify-content: space-between;
  border: 1px solid rgba(217, 164, 78, .3); border-radius: 10px; background: rgba(217, 164, 78, .07);
  padding: 10px 14px; margin: 4px 0 12px; font-size: .9rem;
}
.sp-cart-total b { color: var(--gold-2); font-family: var(--font-head); font-size: 1.05rem; }
.sp-cart-submit { width: 100%; }
.sp-cart-done { text-align: center; padding: 20px 4px; }
.sp-cart-done[hidden] { display: none; }
.sp-cart-code {
  font-family: var(--font-head); font-size: 1.4rem; letter-spacing: .05em; color: var(--gold-2);
  margin: 6px 0 8px; user-select: all;
}
.sp-cart-done-actions { display: grid; gap: 8px; margin-top: 14px; }
.sp-cart-fab {
  position: fixed; left: 16px; bottom: 16px; z-index: 60;
  display: inline-flex; align-items: center; gap: 8px;
  background: #14110f; color: var(--text); border: 1px solid var(--gold);
  border-radius: 40px; padding: 10px 16px; font: inherit; font-size: .84rem; cursor: pointer;
  box-shadow: 0 14px 34px -18px #000;
}
.sp-cart-fab[hidden] { display: none; }
.sp-cart-fab b { color: var(--gold-2); }

@media (max-width: 980px) {
  .sp-guarantees { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .sp-modal-top { flex-direction: column; }
  .sp-modal-art { width: 100%; height: 84px; flex: 0 0 84px; }
  .sp-cart-2col { grid-template-columns: 1fr; }
  .sp-product-actions .btn { font-size: .76rem; }
  .sp-cart-fab { left: 12px; bottom: 12px; font-size: .78rem; padding: 9px 13px; }
}

/* ── รูปสินค้าจริง (เมื่อโค้ชอัปโหลดรูปในหลังบ้าน) ───────────────────── */
.sp-product-art.has-photo {
  min-height: 0;
  aspect-ratio: 16 / 10;
  padding: 0;
  justify-content: flex-end;
  overflow: hidden;
}
/* ป้ายสินค้าอยู่มุมซ้ายบน ไม่ทับหัวข้อ */
.sp-product-art.has-photo .sp-badge { position: absolute; top: 12px; left: 12px; z-index: 3; }
.sp-product-photo {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center 45%;
  transform: scale(1.001);
  transition: transform .6s ease;
}
.sp-product:hover .sp-product-photo { transform: scale(1.035); }
.sp-product-art.has-photo::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(9, 8, 7, .10) 0%, rgba(9, 8, 7, .55) 55%, rgba(9, 8, 7, .94) 100%);
}
.sp-product-art.has-photo .sp-product-white { position: absolute; top: 12px; right: 12px; z-index: 3; }
.sp-product-art.has-photo .sp-product-heading { position: relative; z-index: 2; padding: 0 18px 16px; }
.sp-product-art.has-photo .sp-product-heading h3,
.sp-product-art.has-photo .sp-product-cat { text-shadow: 0 1px 12px rgba(0, 0, 0, .85); }

/* ป้ายสต็อก */
.sp-stock {
  font-size: .74rem; letter-spacing: .02em; white-space: nowrap;
  border: 1px solid rgba(120, 200, 150, .45); border-radius: 999px;
  padding: 3px 10px; color: #9ad8b0;
}
.sp-stock.is-low { border-color: rgba(217, 164, 78, .6); color: var(--gold-2); }
.sp-stock.is-out { border-color: rgba(217, 119, 87, .55); color: #f3b39c; }

/* รูปในกล่อง modal */
.sp-modal-art img { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; display: block; }
.sp-modal-art.has-photo { padding: 0; overflow: hidden; }

/* ราคาปกติขีดฆ่า (เมื่อตั้ง compare_at) */
.sp-price-old { color: #8d8377; text-decoration: line-through; font-size: .86rem; margin-right: 6px; }
