/* ==========================================================================
   Mini Kosmos — Single product page CSS
   Sections: Layout · Gallery · Buy box · Accordion · Related
   Product card styles are in chrome.css (shared).
   ========================================================================== */


/* ==========================================================================
   1. Page layout
   ========================================================================== */

.mk-product-page { padding-bottom: 80px; }

.mk-product-section { padding: 10px 0 60px; }

.mk-product-layout {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 48px;
  align-items: start;
}


/* ==========================================================================
   2. Gallery — WoodMart handles its own gallery styles.
      We just ensure the wrapper fits the layout column.
   ========================================================================== */

.mk-gallery-wrapper {
  position: sticky;
  top: 90px;
  min-width: 0;  /* prevent grid item from expanding beyond its track */
  width: 100%;   /* fill the grid column */
}

/* WoodMart thumbs-position-left: thumbnails are order:-1 (appears left),
   main images have flex: 0 0 100% (full container width).
   Together they overflow the container. Clip the gallery so the
   visible area shows thumbnails on the left + main image filling the rest. */
.mk-gallery-wrapper .woocommerce-product-gallery {
  width: 100% !important;
  overflow: hidden !important;
}


/* ==========================================================================
   3. Buy box
   ========================================================================== */

.mk-buybox { padding: 8px 0; }

.mk-buybox-stars {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.mk-buybox-stars .mk-card-stars svg { color: var(--sun); }

.mk-buybox-rating-text {
  font-size: 13px;
  color: var(--ink-soft);
}

.mk-buybox-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(32px, 4vw, 56px);
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--ink);
  text-wrap: balance;
  margin-bottom: 10px;
}

.mk-buybox-tagline {
  font-size: 17px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin-bottom: 20px;
}

.mk-buybox-price-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 24px;
}

.mk-buybox-price {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(36px, 4vw, 48px);
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.mk-buybox-price-note {
  font-size: 13px;
  color: var(--muted);
}


/* ==========================================================================
   4. ATC form / quantity stepper
   ========================================================================== */

.mk-atc-form .quantity { display: none; } /* Hide WC's duplicate qty input */

.mk-atc-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
  margin-bottom: 18px;
}

.mk-qty-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  flex-shrink: 0;
}

.mk-qty-btn {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: var(--ink);
  transition: background .15s;
  font-family: inherit;
}

.mk-qty-btn:hover { background: rgba(32, 24, 46, .06); }

.mk-qty-btn svg { stroke: var(--ink); fill: none; }

.mk-qty-input {
  width: 36px;
  text-align: center;
  border: none;
  background: transparent;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}

.mk-qty-input::-webkit-outer-spin-button,
.mk-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; }

.mk-atc-btn {
  flex: 1;
  height: 56px;
  border: none;
  border-radius: 999px !important;
  background: var(--ink) !important;
  color: var(--paper);
  font-family: inherit;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: opacity .15s, transform .15s;
  text-transform: none !important;
}

.mk-atc-btn:hover { opacity: .88 !important; transform: translateY(-1px); }
.mk-atc-btn:active { transform: translateY(0); }
.mk-atc-btn:not(.mk-atc-btn--oos):hover { background: var(--ink) !important; }

.mk-atc-btn--oos {
  background: var(--line);
  color: var(--muted);
  cursor: not-allowed;
}

.mk-atc-btn--oos:hover { opacity: 1; transform: none; }

.mk-atc-btn.loading { opacity: .6 !important; pointer-events: none; cursor: wait; }
.mk-atc-btn.added   { background: var(--mint) !important; color: var(--ink) !important; }

/* Info tiles */
.mk-buybox-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 28px;
  padding: 16px;
  border-radius: 20px;
  border: 1px dashed var(--line);
  background: var(--paper);
}

.mk-buybox-tile {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 13px;
}

.mk-buybox-tile > svg { flex-shrink: 0; margin-top: 1px; }
.mk-buybox-tile svg[class*="truck"] { color: var(--coral); }
.mk-buybox-tile svg[class*="sparkle"] { color: var(--sun); }

/* SVG color via fill/stroke — use style attribute on the parent */
.mk-buybox-tile:first-child svg { color: var(--coral); }
.mk-buybox-tile:last-child svg { color: var(--sun); }

.mk-tile-title { font-weight: 600; margin-bottom: 2px; color: var(--ink); }
.mk-tile-body { color: var(--ink-soft); line-height: 1.4; }


/* ==========================================================================
   5. Accordion
   ========================================================================== */

.mk-accordion { border-top: 1px solid var(--line); }

.mk-accordion-item { border-bottom: 1px solid var(--line); }

.mk-accordion-item summary { list-style: none; }
.mk-accordion-item summary::-webkit-details-marker { display: none; }

.mk-accordion-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  cursor: pointer;
  font-weight: 600;
  font-size: 16px;
  color: var(--ink);
  user-select: none;
}

.mk-accordion-icon {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: transform .2s;
}

.mk-accordion-item[open] .mk-accordion-icon {
  transform: rotate(45deg);
}

.mk-accordion-body {
  padding-bottom: 18px;
  color: var(--ink-soft);
  line-height: 1.65;
  font-size: 15px;
}

.mk-accordion-body p { margin-top: 0; margin-bottom: 10px; }
.mk-accordion-body p:last-child { margin-bottom: 0; }

.mk-accordion-specs { display: grid; gap: 8px; }

.mk-spec-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.mk-spec-row:last-child { border-bottom: none; }
.mk-spec-row > span:first-child { color: var(--muted); }
.mk-spec-row > span:last-child { font-weight: 500; color: var(--ink); text-align: right; }


/* ==========================================================================
   6. Related products
   ========================================================================== */

.mk-related-section { padding-bottom: 80px; }


/* ==========================================================================
   7. Responsive
   ========================================================================== */

@media (max-width: 1100px) {
  .mk-product-layout { grid-template-columns: 1fr 1fr; gap: 32px; }
}

@media (max-width: 860px) {
  .mk-product-layout { grid-template-columns: 1fr; gap: 28px; }
  .mk-gallery-wrapper { position: static; }
  .mk-buybox-tiles { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .mk-buybox-price { font-size: clamp(32px, 9vw, 44px); }
  .mk-atc-btn { font-size: 15px; }
  .mk-buybox-tiles { display: none; } /* Hide on very small screens */
}

/* ==========================================================================
   8. Mobile sticky buy bar (shown when buy box scrolled out of view)
   ========================================================================== */

.mk-sticky-buy-bar {
  display: none; /* JS will show once buy box is off-screen */
}

@media (max-width: 768px) {
  .mk-sticky-buy-bar {
    display: block;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    background: var(--cream);
    border-top: 1px solid var(--line);
    padding: 12px 16px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    transform: translateY(100%);
    transition: transform .25s cubic-bezier(.4, 0, .2, 1);
    box-shadow: 0 -8px 24px -8px rgba(32, 24, 46, .12);
  }

  .mk-sticky-buy-bar.is-visible {
    transform: translateY(0);
  }

  .mk-sticky-buy-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    width: min(480px, 100%);
    margin: 0 auto;
  }

  .mk-sticky-buy-info {
    flex: 1;
    min-width: 0;
    display: grid;
    gap: 2px;
  }

  .mk-sticky-buy-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mk-sticky-buy-price {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 16px;
    color: var(--ink);
  }

  .mk-sticky-atc-btn {
    flex-shrink: 0;
    height: 48px;
    padding: 0 22px;
    border-radius: 999px !important;
    background: var(--ink) !important;
    color: var(--paper) !important;
    font-family: inherit;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    border: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    text-transform: none !important;
  }
}
