/**
 * Toolkit - Global CSS
 * Styles applied to all pages
 * Single source of truth for CSS variables
 */

/* ===========================================
   CSS VARIABLES (shared across all files)
   =========================================== */
:root {
  /* Theme palette references */
  --tk-color-primary: var(--theme-palette-color-4, #000);
  --tk-color-accent: var(--theme-palette-color-2, #d4aa73);
  --tk-color-text: var(--theme-palette-color-3, #414141);
  --tk-color-text-muted: var(--theme-palette-color-7, #575757);
  --tk-color-bg: var(--theme-palette-color-8, #fff);
  --tk-color-bg-light: var(--theme-palette-color-6, #fafafa);
  --tk-color-bg-hover: var(--theme-palette-color-6, #fafafa);
  --tk-color-border: var(--theme-palette-color-5, #eaeaec);
  --tk-color-border-light: var(--theme-palette-color-5, #eaeaec);

  /* Stock colors (semantic — not in theme palette) */
  --tk-stock-green: #33b48c;
  --tk-stock-red: #f73959;

  /* Sizing */
  --tk-font-xs: 0.7rem;
  --tk-font-sm: 0.8rem;
  --tk-font-base: 0.875rem;
  --tk-font-md: 0.9375rem;
  --tk-radius-sm: 4px;
  --tk-radius-md: 6px;
  --tk-radius-lg: 8px;
  --tk-radius-full: 50px;

  /* Transitions */
  --tk-transition: 0.3s ease;
  --tk-transition-fast: 0.4s ease;
}

/* ===========================================
   PROMO BANNER
   =========================================== */
.cross-dissolve-slider-container {
  --cycle: 12s;
  --step: 4s;
  flex: 1;
  height: 100%;
  min-height: 30px;
  position: relative;
  font-size: clamp(0.85rem, 2vw, 1rem);
  color: var(--tk-color-bg);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Remove Blocksy HTML element margins */
.ct-header-html:has(.cross-dissolve-slider-container) {
  flex: 1;
  margin: 0 !important;
  padding: 0 !important;
}

.cross-dissolve-slider {
  position: relative;
  width: 100%;
  height: 100%;
}

.cross-dissolve-slider .slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
  opacity: 0;
  will-change: opacity;
  animation: tk-fade var(--cycle) linear infinite both;
  animation-delay: calc(var(--i) * var(--step));
}

.cross-dissolve-slider-container:hover .slide {
  animation-play-state: paused;
}

@keyframes tk-fade {
  0% {
    opacity: 0;
  }
  5% {
    opacity: 1;
  }
  25% {
    opacity: 1;
  }
  33% {
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cross-dissolve-slider .slide {
    animation: none;
    opacity: 1;
  }
  .cross-dissolve-slider .slide:not(:first-child) {
    display: none;
  }
}

/* ===========================================
   STOCK INDICATOR (animated dot)
   =========================================== */
.stock {
  position: relative !important;
  padding-left: 22px !important;
  display: inline-block !important;
  margin-bottom: 20px !important;
}

.stock::before,
.stock::after {
  content: "" !important;
  position: absolute;
  left: 0;
  top: calc(50% - 5px);
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.stock::before {
  z-index: 2;
}

.stock::after {
  z-index: 1;
}

/* In stock */
.stock.in-stock,
.stock.in-stock a,
.stock.shipping-later a {
  color: var(--tk-stock-green) !important;
}

.stock.in-stock::before,
.stock.shipping-later::before {
  background: var(--tk-stock-green);
}

.stock.in-stock::after,
.stock.shipping-later::after {
  background: var(--tk-stock-green);
  animation: tk-pulse-ring 2s infinite cubic-bezier(0.215, 0.61, 0.355, 1);
}

/* Out of stock */
.stock.out-of-stock {
  color: var(--tk-stock-red);
}

.stock.out-of-stock::before {
  background: var(--tk-stock-red);
}

.stock.out-of-stock::after {
  background: var(--tk-stock-red);
  animation: tk-pulse-ring 2s infinite cubic-bezier(0.215, 0.61, 0.355, 1);
}

@keyframes tk-pulse-ring {
  0% {
    transform: scale(0.8);
    opacity: 0.6;
  }
  100% {
    transform: scale(2.4);
    opacity: 0;
  }
}

.stock:hover::after {
  will-change: transform, opacity;
}

@media (prefers-reduced-motion: reduce) {
  .stock.in-stock::after,
  .stock.shipping-later::after,
  .stock.out-of-stock::after {
    animation: none;
  }
}

/* ===========================================
   UX TITLES — GreenShift blocks (single product + category)
   =========================================== */
body.single-product #gspb_text-id-gsbp-d4f64e3 {
  font-size: 30px;
  font-weight: 700;
  color: var(--tk-color-primary);
}

@media screen and (max-width: 600px) {
  body.single-product #gspb_text-id-gsbp-d4f64e3 {
    font-size: 30px;
  }
}

.gsbp-52a8e01 {
  font-size: 20px;
  font-weight: 700;
  color: var(--wp--preset--color--palette-color-4);
}

@media screen and (max-width: 768px) {
  #gsbp-52a8e01 {
    font-size: 22px;
  }
}

h3.gsbp-9d6d93c {
  color: var(--wp--preset--color--palette-color-3);
  font-weight: 400 !important;
  line-height: 1.3;
  margin-bottom: 10px;
  font-size: 14px;
}

@media screen and (max-width: 480px) {
  h3.gsbp-9d6d93c {
    font-size: 13px;
  }
}

/* ============================================
   NEWSLETTER (Fluent Forms)
   ============================================ */
form.fluent_form_5 .wpf_has_custom_css.ff-btn-submit {
  font-size: 18px;
}
@media (max-width: 1024px) and (min-width: 768px) {
  form.fluent_form_5 .wpf_has_custom_css.ff-btn-submit {
    font-size: 15px;
  }
}
