/* ==========================================================================
   Heart to Home — Build Your Own Hamper (h2h-builder)
   Ported from wordpress/theme/heart-to-home/assets/css/h2h.css lines 2013-2281
   (legacy .builder-progress / .progress-step / .builder-step /
   .occasion-select-* / .size-card / .items-category / .item-checkbox /
   .builder-nav / .builder-total block). Every selector renamed to the
   h2hb- namespace per SPEC.md section 3. Visual language (gold / burgundy /
   cream, radius, shadow, easing) kept via var(--x, fallback) so this still
   looks right even if the theme stylesheet is ever missing.
   No @import, no external fonts, no build step, no CDN.
   ========================================================================== */

#h2hb-root {
  box-sizing: border-box;
}
#h2hb-root *,
#h2hb-root *::before,
#h2hb-root *::after {
  box-sizing: inherit;
}

/* ---- Hero ---- */
#h2hb-root .h2hb-hero {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 40px;
}
#h2hb-root .h2hb-eyebrow {
  font-family: var(--font-sans, 'Inter', system-ui, -apple-system, sans-serif);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold, #C5A55A);
  margin: 0 0 10px;
}
#h2hb-root .h2hb-hero h1 {
  margin: 0 0 14px;
}
#h2hb-root .h2hb-lede {
  color: var(--text-muted, #64748B);
  font-size: 1.02rem;
  line-height: 1.6;
  margin: 0;
}

/* ---- Progress rail — ported from .builder-progress / .progress-step ---- */
.h2hb-progress {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 4px;
  flex-wrap: wrap;
  list-style: none;
  margin: 0 0 44px;
  padding: 0;
}
.h2hb-progress-step {
  display: flex;
  align-items: center;
  gap: 8px;
}
/* legacy .progress-connector had no matching element in the new markup —
   reimplemented as a pseudo-element so the rail still reads as connected. */
.h2hb-progress-step:not(:last-child)::after {
  content: "";
  width: 28px;
  height: 2px;
  background: var(--cream-dark, #F3EDE5);
  align-self: center;
  transition: background var(--duration-base, 0.3s) ease;
}
.h2hb-progress-step.is-complete:not(:last-child)::after {
  background: linear-gradient(90deg, var(--burgundy, #722F37), var(--gold, #C5A55A));
}
.h2hb-step-num {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--cream-dark, #F3EDE5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted, #64748B);
  box-shadow: var(--shadow-xs, 0 1px 3px rgba(101, 67, 33, 0.04));
  transition: all var(--duration-base, 0.3s) var(--ease-out-expo, cubic-bezier(0.16, 1, 0.3, 1));
}
.h2hb-progress-step.is-active .h2hb-step-num {
  background: var(--gold, #C5A55A);
  color: var(--black, #1C1917);
  box-shadow: 0 4px 16px rgba(197, 165, 90, 0.35);
  transform: scale(1.08);
}
.h2hb-progress-step.is-complete .h2hb-step-num {
  background: var(--burgundy, #722F37);
  color: var(--white, #FFFFFF);
  box-shadow: 0 2px 8px rgba(114, 47, 55, 0.25);
}
.h2hb-step-label {
  font-size: 0.72rem;
  color: #999;
  font-weight: 500;
  white-space: nowrap;
}
.h2hb-progress-step.is-active .h2hb-step-label {
  color: var(--charcoal, #2D2926);
  font-weight: 600;
}

/* ---- Panels — ported from .builder-step ---- */
.h2hb-panel {
  display: none;
}
.h2hb-panel.is-active {
  display: block;
  animation: h2hbFadeIn 0.4s ease;
}
@keyframes h2hbFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.h2hb-panel h2 {
  text-align: center;
  margin: 0 0 10px;
}
.h2hb-step-desc {
  text-align: center;
  color: var(--text-muted, #64748B);
  margin: 0 0 32px;
}

/* ---- Occasion cards — ported from .occasion-select-grid / .occasion-select-card ---- */
.h2hb-occasion-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.h2hb-occasion-card {
  background: var(--white, #FFFFFF);
  border: 2px solid var(--cream-dark, #F3EDE5);
  border-radius: var(--radius, 16px);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  font: inherit;
  transition: all var(--duration-base, 0.3s) var(--ease-out-expo, cubic-bezier(0.16, 1, 0.3, 1));
  box-shadow: var(--shadow-xs, 0 1px 3px rgba(101, 67, 33, 0.04));
}
.h2hb-occasion-card:hover,
.h2hb-occasion-card:focus-visible {
  border-color: var(--gold, #C5A55A);
  transform: translateY(-3px);
  box-shadow: var(--shadow, 0 4px 24px rgba(101, 67, 33, 0.08));
}
.h2hb-occasion-card.is-selected {
  border-color: var(--gold, #C5A55A);
  background: rgba(197, 165, 90, 0.06);
  box-shadow: 0 4px 20px rgba(197, 165, 90, 0.15);
}
.h2hb-occasion-name {
  font-size: 0.95rem;
  font-weight: 600;
}

/* ---- Surprise CTA + budget cards + surprise note (new in P0 — designed
   fresh with the same tokens, no legacy equivalent existed) ---- */
.h2hb-surprise-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  background: var(--cream-dark, #F3EDE5);
  border: 1px solid rgba(197, 165, 90, 0.3);
  border-radius: var(--radius, 16px);
  padding: 24px;
  margin-bottom: 28px;
}
.h2hb-surprise-cta p {
  margin: 0;
  color: var(--charcoal, #2D2926);
}
.h2hb-budget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.h2hb-budget-card {
  background: var(--white, #FFFFFF);
  border: 2px solid var(--cream-dark, #F3EDE5);
  border-radius: var(--radius, 16px);
  padding: 18px 14px;
  text-align: center;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  color: var(--charcoal, #2D2926);
  transition: all var(--duration-base, 0.3s) var(--ease-out-expo, cubic-bezier(0.16, 1, 0.3, 1));
  box-shadow: var(--shadow-xs, 0 1px 3px rgba(101, 67, 33, 0.04));
}
.h2hb-budget-card:hover,
.h2hb-budget-card:focus-visible {
  border-color: var(--gold, #C5A55A);
  transform: translateY(-3px);
  box-shadow: var(--shadow, 0 4px 24px rgba(101, 67, 33, 0.08));
}
.h2hb-budget-card.is-selected {
  border-color: var(--gold, #C5A55A);
  background: rgba(197, 165, 90, 0.06);
  box-shadow: 0 4px 20px rgba(197, 165, 90, 0.15);
}
.h2hb-surprise-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  background: rgba(197, 165, 90, 0.1);
  border: 1px solid rgba(197, 165, 90, 0.3);
  border-radius: var(--radius-sm, 8px);
  padding: 12px 16px;
  font-size: 0.88rem;
  color: var(--charcoal, #2D2926);
  margin: 0 0 20px;
}
.h2hb-surprise-note[hidden] {
  display: none;
}
.h2hb-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: var(--burgundy, #722F37);
  text-decoration: underline;
  cursor: pointer;
}
.h2hb-link:hover,
.h2hb-link:focus-visible {
  color: var(--gold-dark, #A68B3E);
}
/* transient JS-inserted advisory text (missing-occasion hint, surprise
   picker unavailable) — not in the PHP markup, created by builder.js */
.h2hb-inline-note {
  font-size: 0.85rem;
  color: var(--urgency, #B33323);
  background: var(--blush, #FAE3E3);
  border: 1px solid rgba(179, 51, 35, 0.25);
  border-radius: var(--radius-sm, 8px);
  padding: 10px 14px;
  margin: 12px 0 0;
}

/* ---- Size cards — ported from .size-select-grid / .size-card ---- */
.h2hb-size-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}
.h2hb-size-card {
  background: var(--white, #FFFFFF);
  border: 2px solid var(--cream-dark, #F3EDE5);
  border-radius: var(--radius, 16px);
  padding: 26px;
  text-align: center;
  cursor: pointer;
  font: inherit;
  transition: all var(--duration-base, 0.3s) var(--ease-out-expo, cubic-bezier(0.16, 1, 0.3, 1));
  box-shadow: var(--shadow-xs, 0 1px 3px rgba(101, 67, 33, 0.04));
}
.h2hb-size-card:hover,
.h2hb-size-card:focus-visible {
  border-color: var(--gold, #C5A55A);
  transform: translateY(-3px);
  box-shadow: var(--shadow, 0 4px 24px rgba(101, 67, 33, 0.08));
}
.h2hb-size-card.is-selected {
  border-color: var(--gold, #C5A55A);
  background: rgba(197, 165, 90, 0.06);
  box-shadow: 0 4px 20px rgba(197, 165, 90, 0.15);
}
.h2hb-size-name {
  display: block;
  font-family: var(--font-serif, 'Playfair Display', Georgia, serif);
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.h2hb-size-price {
  display: block;
  font-family: var(--font-sans, 'Inter', system-ui, -apple-system, sans-serif);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--burgundy, #722F37);
  margin: 8px 0;
}
.h2hb-size-items {
  display: block;
  font-size: 0.82rem;
  color: var(--text-muted, #64748B);
}

/* ---- Item / add-on grids — ported from .items-category / .item-checkbox ---- */
.h2hb-category {
  margin-bottom: 28px;
}
.h2hb-category h3 {
  font-family: var(--font-sans, 'Inter', system-ui, -apple-system, sans-serif);
  font-size: 0.78rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold, #C5A55A);
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(197, 165, 90, 0.3);
}
.h2hb-item-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.h2hb-item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: var(--white, #FFFFFF);
  border: 1px solid transparent;
  border-radius: var(--radius-sm, 8px);
  cursor: pointer;
  transition: var(--transition, all 0.3s ease);
}
.h2hb-item-row:hover,
.h2hb-item-row:focus-within {
  border-color: var(--gold, #C5A55A);
}
.h2hb-item-row.is-checked {
  border-color: var(--gold, #C5A55A);
  background: rgba(197, 165, 90, 0.08);
}
.h2hb-item-row input[type="checkbox"] {
  accent-color: var(--gold, #C5A55A);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
/* P0: empty 56px placeholder. P1: an <img> lands inside this span. */
.h2hb-item-media {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-radius: var(--radius-sm, 8px);
  background: var(--cream-dark, #F3EDE5);
  display: block;
  overflow: hidden;
}
.h2hb-item-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.h2hb-item-name {
  flex: 1 1 auto;
  font-size: 0.9rem;
  min-width: 0;
}
.h2hb-item-note {
  flex-basis: 100%;
  font-size: 0.75rem;
  color: var(--text-muted, #64748B);
  margin-left: 68px;
}
.h2hb-item-price {
  flex-shrink: 0;
  font-weight: 600;
  color: var(--burgundy, #722F37);
  font-size: 0.85rem;
}

/* ---- Nav + sticky total — ported from .builder-nav / .builder-total ---- */
.h2hb-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 36px;
  padding-top: 26px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}
.h2hb-total {
  position: sticky;
  bottom: 0;
  z-index: 5;
  background: linear-gradient(135deg, var(--burgundy, #722F37), var(--burgundy-dark, #5A252C));
  color: var(--white, #FFFFFF);
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: var(--radius, 16px);
  margin-top: 28px;
  box-shadow: var(--shadow-hover, 0 16px 48px rgba(101, 67, 33, 0.14));
}
.h2hb-total span {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
}
#h2hb-total-price {
  font-family: var(--font-sans, 'Inter', system-ui, -apple-system, sans-serif);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--gold, #C5A55A);
}

/* ---- Review, error, note, ask link (new in P0) ---- */
.h2hb-review-card {
  background: var(--white, #FFFFFF);
  border: 1px solid var(--cream-dark, #F3EDE5);
  border-radius: var(--radius, 16px);
  padding: 24px;
  box-shadow: var(--shadow, 0 4px 24px rgba(101, 67, 33, 0.08));
  margin-bottom: 24px;
}
.h2hb-review-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  font-size: 0.9rem;
}
.h2hb-review-row:last-child {
  border-bottom: none;
}
.h2hb-review-label {
  color: var(--text-muted, #64748B);
  flex-shrink: 0;
}
.h2hb-review-value {
  text-align: right;
  font-weight: 500;
}
.h2hb-review-total {
  margin-top: 6px;
  padding-top: 14px;
  border-top: 2px solid var(--cream-dark, #F3EDE5);
  border-bottom: none;
}
.h2hb-review-total .h2hb-review-label,
.h2hb-review-total .h2hb-review-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--burgundy, #722F37);
}
.h2hb-error {
  background: var(--blush, #FAE3E3);
  border: 1px solid rgba(179, 51, 35, 0.3);
  color: var(--urgency, #B33323);
  border-radius: var(--radius-sm, 8px);
  padding: 12px 16px;
  margin-top: 16px;
  font-size: 0.88rem;
}
.h2hb-error[hidden] {
  display: none;
}
.h2hb-note {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted, #64748B);
  margin: 16px 0 0;
}
.h2hb-ask {
  text-align: center;
  margin: 8px 0 0;
}
.h2hb-ask-link {
  color: var(--burgundy, #722F37);
  text-decoration: underline;
}
.h2hb-ask-link:hover,
.h2hb-ask-link:focus-visible {
  color: var(--gold-dark, #A68B3E);
}
.h2hb-noscript {
  text-align: center;
  color: var(--text-muted, #64748B);
  padding: 20px;
}

/* ---- Disabled state ---- */
#h2hb-root [aria-disabled="true"],
#h2hb-root button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ---- Hide the theme's WhatsApp float on the builder page ----
   Real markup is <a class="whatsapp-float"> from h2h_footer_furniture()
   in wordpress/theme/heart-to-home/functions.php. Generous selector list
   kept as a hedge against any future rename. ---- */
body.h2hb-page .whatsapp-float,
body.h2hb-page .h2h-whatsapp,
body.h2hb-page [class*="whatsapp"] {
  display: none !important;
}

/* ---- Mobile ---- */
@media (max-width: 640px) {
  .h2hb-occasion-grid,
  .h2hb-size-grid,
  .h2hb-budget-grid,
  .h2hb-item-grid {
    grid-template-columns: 1fr;
  }
  .h2hb-item-note {
    margin-left: 0;
  }
  /* clearance so the sticky total bar never sits over the nav buttons */
  .h2hb-panel.is-active {
    padding-bottom: 88px;
  }
  .h2hb-nav {
    flex-wrap: wrap;
  }
  .h2hb-total {
    padding: 12px 16px;
  }
}
