.bundle-builder {
  --bundle-accent: #e34c34;
  --bundle-accent-ink: #c53b26;
  --bundle-accent-soft: #fff4f1;
  --bundle-ink: #171717;
  --bundle-muted: #6e6862;
  --bundle-line: #d8d1c8;
  --bundle-paper: #fff;
  --bundle-warm: #f6f3ee;
  display: block;
  width: 100%;
  padding: 18px;
  color: var(--bundle-ink);
  background: var(--bundle-warm);
}

.bundle-builder,
.bundle-builder *,
.bundle-builder *::before,
.bundle-builder *::after,
.bundle-builder__config-warning {
  box-sizing: border-box;
}

.bundle-builder[hidden] {
  display: none;
}

.bundle-builder__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10px;
}

.bundle-builder__title {
  margin: 0 0 3px;
  color: var(--bundle-ink);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.bundle-builder__subtitle,
.bundle-builder__estimate {
  margin: 0;
  color: var(--bundle-muted);
  font-size: 12px;
  line-height: 1.45;
}

.bundle-builder__count {
  flex: 0 0 auto;
  min-width: 120px;
  font-size: 11px;
  text-align: right;
}

.bundle-builder__count strong {
  color: var(--bundle-accent-ink);
  font-size: 17px;
}

.bundle-builder__status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
  padding: 7px 10px;
  border-left: 3px solid var(--bundle-accent);
  background: var(--bundle-accent-soft);
  font-size: 11px;
  line-height: 1.35;
}

.bundle-builder__status strong {
  font-weight: 650;
}

.bundle-builder__status > span {
  flex: 0 0 auto;
  color: var(--bundle-accent-ink);
  white-space: nowrap;
}

.bundle-builder__progress {
  position: relative;
  height: 45px;
  margin: 15px 10px 5px;
  padding-top: 5px;
}

.bundle-builder__progress-track {
  position: relative;
  height: 4px;
  border-radius: 99px;
  background: #ded8d0;
}

.bundle-builder__progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background: var(--bundle-accent);
  transition: width 0.25s ease;
}

.bundle-builder__milestone {
  position: absolute;
  top: 0;
  width: 92px;
  color: #7a746d;
  text-align: center;
  transform: translateX(-50%);
}

.bundle-builder__milestone:nth-of-type(2) {
  left: 0;
  text-align: left;
  transform: none;
}

.bundle-builder__milestone:nth-of-type(3) { left: 25%; }
.bundle-builder__milestone:nth-of-type(4) { left: 50%; }
.bundle-builder__milestone:nth-of-type(5) { left: 75%; }

.bundle-builder__milestone:nth-of-type(6) {
  right: 0;
  left: auto;
  text-align: right;
  transform: none;
}

.bundle-builder__milestone-dot {
  display: block;
  width: 14px;
  height: 14px;
  margin: 0 auto 4px;
  border: 3px solid var(--bundle-warm);
  border-radius: 50%;
  background: #c9c2b9;
  box-shadow: 0 0 0 1px #c9c2b9;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.bundle-builder__milestone:nth-of-type(2) .bundle-builder__milestone-dot { margin-left: -7px; }
.bundle-builder__milestone:nth-of-type(6) .bundle-builder__milestone-dot { margin-right: -7px; }

.bundle-builder__milestone.is-active {
  color: var(--bundle-ink);
  font-weight: 650;
}

.bundle-builder__milestone.is-active .bundle-builder__milestone-dot {
  background: var(--bundle-accent);
  box-shadow: 0 0 0 1px var(--bundle-accent);
}

.bundle-builder__milestone-label {
  display: block;
  font-size: 11px;
  white-space: nowrap;
}

.bundle-builder__label-short { display: none; }

.bundle-builder__product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.bundle-builder__card-shell {
  position: relative;
  min-width: 0;
  min-height: 94px;
}

.bundle-builder__card-shell .bundle-builder__card {
  width: 100%;
  height: 100%;
}

.bundle-builder__product-link {
  position: absolute;
  z-index: 2;
  display: block !important;
}

.bundle-builder__product-link--name {
  top: 0;
  right: 34px;
  left: 72px;
  height: 48px;
}

.bundle-builder__product-link:focus-visible {
  outline: 2px solid var(--bundle-ink);
  outline-offset: -3px;
}

.bundle-builder__card-shell:has(.bundle-builder__product-link--name:hover) .bundle-builder__card-name {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.bundle-builder__card-image {
  transition: transform 0.15s ease;
}

.bundle-builder__quantity {
  position: absolute;
  z-index: 3;
  right: 8px;
  bottom: 8px;
  display: flex;
  align-items: center;
  overflow: hidden;
  height: 26px;
  border: 1px solid #cfc8bf;
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(28, 23, 18, 0.06);
}

.bundle-builder__quantity button {
  display: grid;
  place-items: center;
  width: 27px;
  height: 24px;
  padding: 0;
  border: 0;
  color: var(--bundle-ink);
  background: #f5f2ed;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  line-height: 1;
}

.bundle-builder__quantity button:hover { background: #e9e4dc; }

.bundle-builder__quantity span {
  min-width: 27px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.bundle-builder__card-shell:has(.bundle-builder__quantity) .bundle-builder__card-copy {
  padding-bottom: 38px;
}

.bundle-builder__card-shell:has(.bundle-builder__quantity) .bundle-builder__card-meta {
  margin-top: 3px;
}

.bundle-builder__card-shell:has(.bundle-builder__quantity) .bundle-builder__card-meta strong {
  position: absolute;
  bottom: 12px;
  left: 82px;
  font-size: 11px;
}

.bundle-builder__card {
  position: relative;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  min-width: 0;
  min-height: 94px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--bundle-line);
  border-radius: 0;
  color: var(--bundle-ink);
  background: var(--bundle-paper);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.bundle-builder__card:hover:not(:disabled),
.bundle-builder__card:focus-visible {
  border-color: #b7afa6;
  box-shadow: 0 6px 16px rgba(28, 23, 18, 0.08);
  transform: translateY(-2px);
}

.bundle-builder__card:focus-visible,
.bundle-builder__add-button:focus-visible {
  outline: 2px solid var(--bundle-ink);
  outline-offset: 2px;
}

.bundle-builder__card[aria-pressed='true'] {
  border-color: var(--bundle-accent);
  box-shadow: inset 0 0 0 1px var(--bundle-accent);
}

.bundle-builder__card:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.bundle-builder__card[aria-disabled='true'] {
  pointer-events: none;
}

.bundle-builder__card-media {
  display: block;
  width: 72px;
  height: 100%;
  min-height: 94px;
  background: #fff;
}

.bundle-builder__card-image {
  display: block;
  width: 100%;
  height: 100%;
  padding: 5px;
  object-fit: contain;
  background: #fff;
}

.bundle-builder__card-copy {
  align-self: center;
  min-width: 0;
  padding: 9px 30px 9px 10px;
}

.bundle-builder__card-name {
  display: -webkit-box;
  height: 30px;
  overflow: hidden;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.25;
  text-overflow: ellipsis;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.bundle-builder__card-meta {
  display: flex;
  justify-content: space-between;
  gap: 7px;
  margin-top: 6px;
  color: var(--bundle-muted);
  font-size: 11px;
}

.bundle-builder__card-meta span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bundle-builder__card-meta strong {
  flex: 0 0 auto;
  color: var(--bundle-ink);
  font-weight: 650;
}

.bundle-builder__select-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid #cfc8bf;
  border-radius: 50%;
  color: transparent;
  background: rgba(255, 255, 255, 0.96);
  font-size: 11px;
}

.bundle-builder__card[aria-pressed='true'] .bundle-builder__select-dot {
  border-color: var(--bundle-accent);
  color: #fff;
  background: var(--bundle-accent);
}

.bundle-builder__recommended {
  position: absolute;
  top: 5px;
  left: 5px;
  z-index: 2;
  padding: 3px 5px;
  color: #fff;
  background: var(--bundle-accent);
  font-size: 8px;
  letter-spacing: 0.03em;
  line-height: 1;
  text-transform: uppercase;
}

.bundle-builder__sold-out {
  display: block;
  margin-top: 4px;
  color: var(--bundle-accent-ink);
  font-size: 10px;
  font-weight: 650;
}

.bundle-builder__summary {
  display: grid;
  grid-template-columns: minmax(160px, 2fr) minmax(230px, 3fr);
  gap: 16px;
  align-items: center;
  margin: 0 -18px -18px;
  padding: 13px 18px 15px;
  border-top: 1px solid #d7d0c7;
  background: #f6f3ee;
}

.bundle-builder__price-lines {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 10px;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
}

.bundle-builder__price-lines > :nth-child(even) { text-align: right; }

.bundle-builder__price-lines > strong {
  margin-top: 1px;
  color: var(--bundle-ink);
  font-size: 17px;
  line-height: 1.15;
}

.bundle-builder__saving { color: var(--bundle-accent-ink); }
.bundle-builder__action { min-width: 0; }

.bundle-builder__add-button {
  position: relative;
  width: 100%;
  min-height: 43px;
  padding: 12px 14px;
  border: 1px solid var(--bundle-ink);
  border-radius: 0;
  color: #fff;
  background: var(--bundle-ink);
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.03em;
}

.bundle-builder__add-button:disabled {
  border-color: #aaa39b;
  color: #fff;
  background: #aaa39b;
  cursor: not-allowed;
}

.bundle-builder__estimate {
  margin-top: 5px;
  font-size: 10px;
  text-align: center;
}

.bundle-builder__spinner {
  display: none;
  width: 15px;
  height: 15px;
  margin-left: 7px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  vertical-align: -3px;
  animation: bundle-spin 0.7s linear infinite;
}

.bundle-builder.is-loading .bundle-builder__spinner { display: inline-block; }

@keyframes bundle-spin { to { transform: rotate(360deg); } }

.bundle-builder__message {
  min-height: 16px;
  margin: 8px 0 0;
  font-size: 11px;
}

.bundle-builder__message.is-error { color: #b42318; }
.bundle-builder__message.is-success { color: #237a49; }

.bundle-builder__config-warning {
  grid-column: 1 / -1;
  padding: 12px;
  border: 1px dashed #c53b26;
  color: #8b2b1c;
  background: #fff4f1;
  font-size: 12px;
  line-height: 1.45;
}

@media (max-width: 1120px) {
  .bundle-builder__summary { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .bundle-builder { padding: 16px 14px; }
  .bundle-builder__header { align-items: flex-start; flex-direction: column; gap: 6px; }
  .bundle-builder__title { font-size: 21px; }
  .bundle-builder__count { min-width: 0; text-align: left; }
  .bundle-builder__status { align-items: flex-start; flex-direction: column; gap: 3px; }
  .bundle-builder__progress { margin-inline: 18px; }
  .bundle-builder__milestone { width: 64px; }
  .bundle-builder__milestone-label { font-size: 10px; }
  .bundle-builder__product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bundle-builder__card { grid-template-columns: 1fr; min-height: 0; }
  .bundle-builder__card-media { width: 100%; height: 86px; min-height: 0; }
  .bundle-builder__card-copy { padding: 7px 26px 8px 8px; }
  .bundle-builder__card-name { height: 27px; font-size: 11px; }
  .bundle-builder__card-meta { margin-top: 4px; font-size: 10px; }
  .bundle-builder__product-link--name { left: 0; top: 86px; height: 41px; }
  .bundle-builder__card-shell:has(.bundle-builder__quantity) .bundle-builder__card-meta strong {
    bottom: 12px;
    left: 8px;
  }
  .bundle-builder__summary { grid-template-columns: 1fr; gap: 10px; margin: 0 -14px -16px; padding: 13px 14px 15px; }
}

@media (max-width: 350px) {
  .bundle-builder__progress { margin-inline: 12px; }
  .bundle-builder__milestone { width: 48px; }
  .bundle-builder__label-long { display: none; }
  .bundle-builder__label-short { display: inline; }
  .bundle-builder__milestone-label { font-size: 9px; }
  .bundle-builder__card-media { height: 74px; }
  .bundle-builder__product-link--name { top: 74px; }
  .bundle-builder__card-meta { align-items: flex-start; flex-direction: column; gap: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  .bundle-builder *,
  .bundle-builder *::before,
  .bundle-builder *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

.bundle-builder__card[hidden] { display: none; }
.bundle-builder__summary { margin-top: 18px; }
.bundle-builder__progress[hidden] { display: none; }
.bundle-builder__milestone { width: auto; max-width: 80px; right: auto !important; text-align: center !important; transform: translateX(-50%) !important; }
.bundle-builder__milestone .bundle-builder__milestone-dot { margin-left: auto !important; margin-right: auto !important; }

/* Render-time attribute prevents discount content flashing before JS loads. */
.bundle-builder:is([data-discount-preview='false'], [data-discount-empty='true']) .bundle-builder__status,
.bundle-builder:is([data-discount-preview='false'], [data-discount-empty='true']) .bundle-builder__progress,
.bundle-builder:is([data-discount-preview='false'], [data-discount-empty='true']) [data-discount-detail],
.bundle-builder:is([data-discount-preview='false'], [data-discount-empty='true']) .bundle-builder__estimate {
  display: none !important;
}
.bundle-builder[data-discount-preview='false'] .bundle-builder__product-grid {
  margin-top: 14px;
}
