/* ================================================================
   Codarab Shop Shortcode — shop.css v3.0
   Design: Editorial Premium · Minimalist · Modern · Fully Responsive
   Palette: Warm ivory · Charcoal · Amber gold
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600;700&family=Outfit:wght@300;400;500;600;700&display=swap');

/* ── Design Tokens ── */
.cshop {
  --ink:      #0f0f0e;
  --ink-2:    #3a3832;
  --ink-3:    #7a7670;
  --gold:     #b8975a;
  --gold-lt:  #f5ede0;
  --cream:    #fafaf7;
  --white:    #ffffff;
  --border:   #e8e4dc;
  --border2:  #d4cfc6;

  --f-display: 'Playfair Display', Georgia, serif;
  --f-body:    'Outfit', system-ui, sans-serif;

  --r:      12px;
  --r-pill: 100px;

  --sh-sm: 0 1px 4px rgba(15,15,14,.06), 0 2px 12px rgba(15,15,14,.04);
  --sh-md: 0 4px 20px rgba(15,15,14,.09), 0 1px 4px rgba(15,15,14,.05);
  --sh-lg: 0 12px 48px rgba(15,15,14,.13), 0 2px 8px rgba(15,15,14,.06);

  --ease: cubic-bezier(.4,0,.2,1);
  --tr:   .28s var(--ease);

  font-family: var(--f-body);
  background:  var(--cream);
  color:       var(--ink);
  padding:     0 0 80px;
  width:       100%;
  box-sizing:  border-box;
}

/* ================================================================
   SHOP HEADER
   ================================================================ */
.cshop-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 48px 0 36px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}
.cshop-eyebrow {
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 10px;
}
.cshop-title {
  font-family: var(--f-display);
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 8px;
  letter-spacing: -.02em;
  line-height: 1.15;
}
.cshop-subtitle {
  font-size: .92rem;
  color: var(--ink-3);
  margin: 0;
  max-width: 460px;
  line-height: 1.6;
}
.cshop-count-pill {
  display: inline-flex;
  align-items: center;
  background: var(--gold-lt);
  color: var(--gold);
  border: 1px solid rgba(184,151,90,.22);
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: .06em;
  padding: 6px 16px;
  border-radius: var(--r-pill);
  white-space: nowrap;
}

/* ================================================================
   CONTROLS — filters + search + sort
   ================================================================ */
.cshop-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 30px;
}

/* Category pills */
.cshop-cats-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}
.cshop-cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 15px;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--border2);
  background: var(--white);
  font-family: var(--f-body);
  font-size: .78rem;
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  transition: all var(--tr);
  white-space: nowrap;
  cursor: pointer;
}
.cshop-cat-pill:hover {
  border-color: var(--ink);
  color: var(--ink);
}
.cshop-cat-pill.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--white);
}
.cshop-cat-count {
  font-size: .7rem;
  opacity: .6;
}

.cshop-controls-right {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
}

/* Search bar */
.cshop-search {
  display: flex;
  align-items: center;
  background: var(--white);
  border: 1.5px solid var(--border2);
  border-radius: var(--r-pill);
  padding: 0 12px;
  transition: border-color var(--tr), box-shadow var(--tr);
  overflow: hidden;
}
.cshop-search:focus-within {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(15,15,14,.06);
}
.cshop-search-icon {
  width: 14px;
  height: 14px;
  color: var(--ink-3);
  flex-shrink: 0;
}
.cshop-search-input {
  border: none;
  background: transparent;
  padding: 8px 9px;
  font-family: var(--f-body);
  font-size: .84rem;
  color: var(--ink);
  outline: none;
  width: 160px;
}
.cshop-search-input::placeholder { color: var(--ink-3); }
.cshop-search-clear {
  font-size: .78rem;
  color: var(--ink-3);
  text-decoration: none;
  padding: 2px 4px;
  transition: color var(--tr);
  line-height: 1;
}
.cshop-search-clear:hover { color: var(--ink); }

/* Sort dropdown */
.cshop-sort {
  appearance: none;
  -webkit-appearance: none;
  background: var(--white)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%237a7670' stroke-width='1.4' fill='none' stroke-linecap='round'/%3E%3C/svg%3E")
    no-repeat right 12px center;
  border: 1.5px solid var(--border2);
  border-radius: var(--r-pill);
  padding: 8px 34px 8px 14px;
  font-family: var(--f-body);
  font-size: .8rem;
  font-weight: 500;
  color: var(--ink-2);
  cursor: pointer;
  outline: none;
  transition: border-color var(--tr);
}
.cshop-sort:hover, .cshop-sort:focus { border-color: var(--ink); }

/* ================================================================
   GRID
   ================================================================ */
.cshop-grid {
  display: grid;
  gap: 24px;
}
.cshop-cols-4 { grid-template-columns: repeat(4, 1fr); }
.cshop-cols-3 { grid-template-columns: repeat(3, 1fr); }
.cshop-cols-2 { grid-template-columns: repeat(2, 1fr); }
.cshop-cols-1 { grid-template-columns: 1fr; }

@media (max-width: 1280px) { .cshop-cols-4                    { grid-template-columns: repeat(3,1fr); } }
@media (max-width: 960px)  { .cshop-cols-4, .cshop-cols-3    { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 560px)  { .cshop-grid                     { grid-template-columns: 1fr !important; gap: 16px; } }

/* ================================================================
   PRODUCT CARD — flex column so the button always sits at the bottom
   ================================================================ */
.cshop-card {
  display: flex;
  flex-direction: column;   /* stack: image → info → (info has flex:1) */
  background: var(--white);
  border-radius: var(--r);
  border: 1px solid var(--border);
  box-shadow: var(--sh-sm);
  overflow: hidden;
  position: relative;
  transition: transform var(--tr), box-shadow var(--tr), border-color var(--tr);
  animation: cshopIn .5s var(--ease) both;
  animation-delay: var(--delay, 0s);
}
.cshop-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--sh-lg);
  border-color: var(--border2);
}

/* Sale badge */
.cshop-badge-sale {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 4;
  background: var(--gold);
  color: var(--white);
  font-family: var(--f-body);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .07em;
  padding: 4px 11px;
  border-radius: var(--r-pill);
}

/* ================================================================
   ★ IMAGE ZONE
   Key: aspect-ratio keeps proportions, object-fit:contain shows
        the FULL image without ANY cropping. padding gives breathing
        room around the cover. Full-size URL avoids WC thumbnail crop.
   ================================================================ */
.cshop-img-wrap {
  display: block;
  position: relative;
  width: 100%;
  /* Portrait aspect ratio — fits book covers perfectly */
  aspect-ratio: 3 / 4;
  background: var(--cream);
  overflow: hidden;
  flex-shrink: 0;           /* never compress the image zone */
  text-decoration: none;
}

.cshop-img-wrap img {
  /* ★ THE KEY RULES — do not change */
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;       /* full image always visible */
  object-position: center center !important;
  display: block !important;
  padding: 18px !important;            /* breathing room around cover */
  box-sizing: border-box !important;
  transition: transform .5s var(--ease) !important;
  /* Override any Astra / theme image styles */
  max-width: none !important;
  max-height: none !important;
  border-radius: 0 !important;
}

.cshop-card:hover .cshop-img-wrap img {
  transform: scale(1.05) !important;
}

/* Hover overlay */
.cshop-img-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15,15,14,.42);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--tr);
}
.cshop-card:hover .cshop-img-overlay { opacity: 1; }

.cshop-quick-look {
  font-family: var(--f-body);
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .07em;
  color: var(--white);
  border: 1.5px solid rgba(255,255,255,.65);
  border-radius: var(--r-pill);
  padding: 8px 20px;
  transform: translateY(8px);
  transition: transform var(--tr);
}
.cshop-card:hover .cshop-quick-look { transform: translateY(0); }

/* ================================================================
   PRODUCT INFO — flex:1 makes it grow to push .cshop-bottom to the
   absolute bottom of every card regardless of title length
   ================================================================ */
.cshop-info {
  display: flex;
  flex-direction: column;
  flex: 1;                  /* ★ fills remaining card height */
  padding: 18px 18px 0;
}

/* Category label */
.cshop-cat-label {
  font-size: .67rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--gold);
  display: block;
  margin-bottom: 7px;
}

/* Product name */
.cshop-name-link { text-decoration: none; }
.cshop-name {
  font-family: var(--f-display);
  font-size: 1rem;
  font-weight: 500;
  color: var(--ink);
  margin: 0 0 9px;
  line-height: 1.38;
  letter-spacing: -.01em;
  /* Fixed height = exactly 2 lines = buttons always on same horizontal line */
  min-height: 2.76em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color var(--tr);
}
.cshop-name-link:hover .cshop-name { color: var(--gold); }

/* Star ratings */
.cshop-stars {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-bottom: 8px;
}
.cshop-star {
  font-size: 13px;
  color: #e0dbd2;
  line-height: 1;
}
.cshop-star--full { color: var(--gold); }
.cshop-star--half {
  background: linear-gradient(90deg, var(--gold) 50%, #e0dbd2 50%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.cshop-rating-num {
  font-size: .73rem;
  color: var(--ink-3);
  margin-left: 4px;
  font-weight: 500;
}

/* ================================================================
   ★ BOTTOM ROW — price + button always at the same level
   margin-top:auto pushes this row to the very bottom of each card
   ================================================================ */
.cshop-bottom {
  margin-top: auto;          /* ★ always pinned to card bottom */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 0 18px;
  border-top: 1px solid var(--border);
  /* Negative margins so the border stretches edge-to-edge */
  margin-left: -18px;
  margin-right: -18px;
  padding-left: 18px;
  padding-right: 18px;
}

/* Price */
.cshop-price {
  font-family: var(--f-display);
  font-size: 1.22rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -.02em;
  line-height: 1;
  flex-shrink: 0;
}
.cshop-price del {
  display: block;
  font-size: .8em;
  color: var(--ink-3);
  font-weight: 400;
  font-family: var(--f-body);
  text-decoration: line-through;
  letter-spacing: 0;
  margin-bottom: 2px;
}
.cshop-price ins { text-decoration: none; color: var(--gold); }

/* ================================================================
   ★ BUTTON — pill, charcoal → gold on hover, arrow slides right
   ================================================================ */
.cshop-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--white);
  border: none;
  border-radius: var(--r-pill);
  font-family: var(--f-body);
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .03em;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--tr), gap var(--tr), color var(--tr);
  white-space: nowrap;
  flex-shrink: 0;
}
.cshop-btn:hover {
  background: var(--gold);
  gap: 11px;
  color: var(--white);
}
.cshop-btn:active { transform: scale(.97); }

.cshop-btn-icon {
  width: 15px;
  height: 15px;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.cshop-btn-icon svg { width: 100%; height: 100%; }

/* Out of stock variant */
.cshop-btn--out {
  background: var(--border);
  color: var(--ink-3);
  cursor: not-allowed;
}
.cshop-btn--out:hover { background: var(--border); gap: 7px; color: var(--ink-3); }

/* AJAX states */
.cshop-btn--loading { opacity: .65; pointer-events: none; }
.cshop-btn--added   { background: #2a7c4f !important; }

/* ================================================================
   PAGINATION
   ================================================================ */
.cshop-pagination {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 52px;
}
.cshop-page a,
.cshop-page span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  background: var(--white);
  border: 1.5px solid var(--border);
  font-family: var(--f-body);
  font-size: .84rem;
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  transition: all var(--tr);
}
.cshop-page a:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--white);
}
.cshop-page span.current {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--white);
  font-weight: 600;
}

/* ================================================================
   NO RESULTS
   ================================================================ */
.cshop-empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--ink-3);
}
.cshop-empty-icon {
  font-size: 2.8rem;
  line-height: 1;
  margin-bottom: 18px;
  color: var(--border2);
}
.cshop-empty h3 {
  font-family: var(--f-display);
  font-size: 1.45rem;
  font-weight: 500;
  color: var(--ink);
  margin: 0 0 8px;
}
.cshop-empty p { font-size: .93rem; margin: 0 0 26px; }
.cshop-empty .cshop-btn { display: inline-flex; }

/* ================================================================
   ENTRY ANIMATION
   ================================================================ */
@keyframes cshopIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 900px) {
  .cshop-header { flex-direction: column; align-items: flex-start; padding: 32px 0 24px; }
  .cshop-controls { flex-direction: column; align-items: flex-start; }
  .cshop-controls-right { width: 100%; }
  .cshop-search { flex: 1; }
  .cshop-search-input { width: 100%; flex: 1; }
  .cshop-sort { width: 100%; }
}

@media (max-width: 560px) {
  .cshop-title { font-size: 1.7rem; }
  .cshop-img-wrap { aspect-ratio: 3 / 3.5; }
  .cshop-cats-nav { gap: 5px; }
  .cshop-cat-pill { font-size: .74rem; padding: 5px 12px; }
}

/* ================================================================
   Native WooCommerce button class overrides
   WC adds: .add_to_cart_button .ajax_add_to_cart .loading .added
   We restyle them to match our design while keeping WC JS working
   ================================================================ */

/* Loading state (WC adds this class while AJAX runs) */
.cshop-btn.loading {
    opacity: .65 !important;
    pointer-events: none !important;
    cursor: wait !important;
}
.cshop-btn.loading .cshop-btn-label::after {
    content: '...';
}

/* Added state (WC adds this after successful add) */
.cshop-btn.added,
.cshop-btn.cshop-btn--added {
    background: #2a7c4f !important;
    gap: 7px !important;
    color: #fff !important;
}

/* Remove WooCommerce's default button styles that conflict */
.cshop .add_to_cart_button,
.cshop .ajax_add_to_cart {
    display: inline-flex !important;
    align-items: center !important;
    border-radius: var(--r-pill) !important;
    text-decoration: none !important;
    transition: background var(--tr), gap var(--tr) !important;
    /* Reset any Astra/WC default button padding/colors */
    box-shadow: none !important;
    border: none !important;
    font-family: var(--f-body) !important;
    font-size: .8rem !important;
    font-weight: 600 !important;
    letter-spacing: .03em !important;
    white-space: nowrap !important;
}
