/* ---------------------------------------------------------------
   Custom Build Designer â photo editor modal.
   Scoped under body.home-v2 #cbe-modal so it inherits the Sand & Ink
   tokens (--hv-*) already defined in home-v2.css. Loaded only on the
   homepage, only when the "Start a Custom Build" button is used.
   --------------------------------------------------------------- */
body.home-v2 #cbe-modal{
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
}
body.home-v2 #cbe-modal.cbe-open{ display: block; }

body.home-v2 .cbe-backdrop{
  position: absolute;
  inset: 0;
  background: rgba(8,7,6,0.78);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

body.home-v2 .cbe-panel{
  position: relative;
  z-index: 1;
  width: min(1000px, 94vw);
  max-height: 92vh;
  margin: 4vh auto;
  display: flex;
  flex-direction: column;
  background: var(--hv-panel);
  border: 1px solid var(--hv-line-btn);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,0.55);
}

body.home-v2 .cbe-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--hv-line);
  flex-shrink: 0;
}
body.home-v2 .cbe-title{
  font-family: var(--hv-display);
  font-weight: 800;
  font-size: 18px;
  color: var(--hv-paper);
  letter-spacing: -0.01em;
}
body.home-v2 .cbe-eyebrow{
  display: block;
  font-family: var(--hv-mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--hv-sand);
  margin-bottom: 4px;
}
body.home-v2 .cbe-close{
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--hv-line-btn);
  background: transparent;
  color: var(--hv-text-3);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
body.home-v2 .cbe-close:hover{ border-color: var(--hv-sand); color: var(--hv-sand); }

body.home-v2 .cbe-body{
  padding: 22px;
  overflow-y: auto;
  flex: 1 1 auto;
}

/* Step 1 â product picker */
body.home-v2 .cbe-step-label{
  font-family: var(--hv-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--hv-text-4);
  margin: 0 0 16px;
}
body.home-v2 .cbe-product-grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
}
body.home-v2 .cbe-product-card{
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--hv-line);
  border-radius: 12px;
  background: var(--hv-panel-2);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
body.home-v2 .cbe-product-card:hover{ border-color: var(--hv-line-btn); transform: translateY(-2px); }
body.home-v2 .cbe-product-card img{
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}
body.home-v2 .cbe-product-card .cbe-pname{
  font-family: var(--hv-body);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--hv-paper);
  line-height: 1.3;
}
body.home-v2 .cbe-product-card .cbe-pprice{
  font-family: var(--hv-mono);
  font-size: 11px;
  color: var(--hv-sand);
}
body.home-v2 .cbe-pick-empty{
  font-family: var(--hv-body);
  font-size: 13px;
  color: var(--hv-text-3);
  padding: 30px 0;
  text-align: center;
}

/* Step 2 â editor */
body.home-v2 .cbe-toolbar{
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
body.home-v2 .cbe-tool-btn{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--hv-line-btn);
  background: var(--hv-panel-2);
  color: var(--hv-text-2);
  font-family: var(--hv-body);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}
body.home-v2 .cbe-tool-btn:hover{ border-color: var(--hv-sand); color: var(--hv-paper); }
body.home-v2 .cbe-tool-btn.cbe-active{ background: var(--hv-sand); border-color: var(--hv-sand); color: var(--hv-ink); }
body.home-v2 .cbe-tool-sep{
  width: 1px; height: 22px;
  background: var(--hv-line-btn);
  margin: 0 4px;
}
body.home-v2 .cbe-swatch{
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--hv-line-btn);
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  background: none;
}
body.home-v2 .cbe-swatch input[type="color"]{
  width: 46px; height: 46px;
  margin: -6px;
  border: none;
  cursor: pointer;
  background: none;
}
body.home-v2 .cbe-range{
  width: 90px;
  accent-color: var(--hv-sand);
}
body.home-v2 .cbe-range-label{
  font-family: var(--hv-mono);
  font-size: 10px;
  color: var(--hv-text-4);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

body.home-v2 .cbe-canvas-wrap{
  display: flex;
  justify-content: center;
  padding: 18px;
  background:
    repeating-conic-gradient(var(--hv-panel-2) 0% 25%, var(--hv-ink) 0% 50%) 50% / 18px 18px;
  border: 1px solid var(--hv-line);
  border-radius: 12px;
}
body.home-v2 .cbe-canvas-wrap canvas{
  max-width: 100%;
  border-radius: 4px;
}

body.home-v2 .cbe-hint{
  margin-top: 12px;
  font-family: var(--hv-body);
  font-size: 12px;
  color: var(--hv-text-4);
  text-align: center;
}

body.home-v2 .cbe-footer{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 22px;
  border-top: 1px solid var(--hv-line);
  flex-shrink: 0;
}
body.home-v2 .cbe-selected-name{
  font-family: var(--hv-body);
  font-size: 13px;
  color: var(--hv-text-3);
}
body.home-v2 .cbe-selected-name strong{ color: var(--hv-paper); }
body.home-v2 #cbe-save-to-cart{
  padding: 13px 22px;
  font-size: 13px;
}
body.home-v2 #cbe-save-to-cart:disabled{
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 640px){
  body.home-v2 .cbe-panel{ width: 100vw; max-height: 100vh; margin: 0; border-radius: 0; height: 100vh; }
  body.home-v2 .cbe-product-grid{ grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  body.home-v2 .cbe-footer{ flex-direction: column; align-items: stretch; }
  body.home-v2 #cbe-save-to-cart{ width: 100%; }
}


body.home-v2 .cbe-sticker-panel[hidden]{ display: none; }
body.home-v2 .cbe-sticker-panel{
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  width: 260px;
  padding: 10px;
  background: var(--hv-panel-2);
  border: 1px solid var(--hv-line-btn);
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.45);
}
body.home-v2 .cbe-sticker-item{
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 6px;
  border-radius: 8px;
  border: 1px solid var(--hv-line-btn);
  background: var(--hv-panel);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
body.home-v2 .cbe-sticker-item:hover{ border-color: var(--hv-sand); background: var(--hv-panel-2); }
body.home-v2 .cbe-sticker-item svg{ width: 100%; height: 100%; }
@media (max-width: 640px){
  body.home-v2 .cbe-sticker-panel{ width: 220px; grid-template-columns: repeat(4, 1fr); }
}
