/* Preview-commerce conversion / reassure — scoped to html.preview-commerce */

html.preview-commerce .preview-commerce-stack {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  width: min(1099px, 100%) !important;
  max-width: 1099px !important;
  margin: 0 auto !important;
  gap: 0 !important;
}

html.preview-commerce .preview-commerce-stack > .preview-commerce-layout {
  width: 100% !important;
}

/* —— Preview badge —— */
.commerce-preview-badge {
  display: none;
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 6;
  padding: 5px 9px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(0, 0, 0, 0.06);
  color: #5a6170;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1;
  pointer-events: none;
  backdrop-filter: blur(6px);
}

html.preview-commerce .commerce-preview-badge:not([hidden]) {
  display: inline-flex;
}

/* Hide scale aids / quarter while comparing the original photo */
html.preview-commerce.commerce-showing-original .scale-aids,
html.preview-commerce.commerce-showing-original .scale-quarter-note,
html.preview-commerce.commerce-showing-original .scale-quarter-note--3d,
html.preview-commerce.commerce-showing-original #viewer-scale-aids,
html.preview-commerce.commerce-showing-original #viewer-scale-quarter-note {
  display: none !important;
  visibility: hidden !important;
}

/* —— Original photo overlay —— */
.commerce-original-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: none;
  align-items: center;
  justify-content: center;
  background: #eef1f6;
  padding: 16px;
  box-sizing: border-box;
}

.commerce-original-overlay:not([hidden]) {
  display: flex;
}

.commerce-original-overlay__img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
}

.commerce-original-overlay__label {
  display: none !important;
}

/* —— Compare tabs —— */
.commerce-compare {
  display: none;
  width: 100%;
  margin: 10px 0 0;
}

html.preview-commerce .commerce-compare:not([hidden]) {
  display: block;
}

.commerce-compare__tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.commerce-compare__tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 6px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #5a6170;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.commerce-compare__tab.is-active {
  background: #fff;
  color: #12141a;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.08);
}

.commerce-compare__thumb {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  object-fit: cover;
  flex: 0 0 auto;
}

/* —— Status + size cards —— */
.commerce-status {
  margin: 0 0 4px;
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent, #307fe2);
  line-height: 1.3;
}

.commerce-config-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2px 6px;
  margin: 0 0 10px;
  padding: 7px 8px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  background: #fafbfd;
}

.commerce-config-summary__row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: 0;
  text-align: center;
}

.commerce-config-summary__label {
  font-size: 0.58rem;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #5a6170;
  line-height: 1.15;
}

.commerce-config-summary__value {
  min-width: 0;
  width: 100%;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #12141a;
  line-height: 1.15;
  word-break: break-word;
}

/* Legacy size-card selectors kept empty-safe if markup is cached */
.commerce-size-cards,
.commerce-size-card {
  display: none !important;
}

html.preview-commerce .commerce-panel-actions {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;
  gap: 8px;
  width: 100%;
  margin: 8px 0 0;
}

html.preview-commerce .commerce-panel-action-btn {
  flex: 1 1 0;
  min-width: 0;
  width: auto !important;
  max-width: none;
  min-height: 40px;
  margin-bottom: 0 !important;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
  text-align: center;
  white-space: normal;
}

/* —— Trust row under ATC —— */
.commerce-trust-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  margin: 12px 0 0;
  padding: 0 2px;
}

.commerce-trust-row__item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: #12141a;
  line-height: 1.3;
}

.commerce-trust-row__mark {
  color: #1b7f4e;
  font-weight: 800;
  flex: 0 0 auto;
}

.commerce-arrive-simple {
  margin: 0;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #12141a;
  line-height: 1.35;
}

.commerce-reassure__media-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 16px;
  border: 1px dashed rgba(0, 0, 0, 0.12);
  background: linear-gradient(180deg, #f4f6fa 0%, #eef1f6 100%);
  color: #8a91a0;
  font-size: 0.88rem;
  font-weight: 550;
  letter-spacing: -0.01em;
  text-align: center;
  padding: 24px;
  box-sizing: border-box;
}

.commerce-reassure__media-placeholder[hidden] {
  display: none !important;
}

.commerce-reassure__video-wrap[hidden] {
  display: none !important;
}

/* —— B2G1 presentation variants —— */
.commerce-bogo[data-bogo-presentation="collapsed"] .commerce-bogo-badge,
.commerce-bogo[data-bogo-presentation="collapsed"] .commerce-bogo-body,
.commerce-bogo[data-bogo-presentation="collapsed"] .commerce-bogo-footer {
  display: none;
}

.commerce-bogo[data-bogo-presentation="collapsed"] {
  margin-top: 14px;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}

.commerce-bogo-collapsed-link {
  display: none;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(var(--holo-blue-rgb, 48, 127, 226), 0.18);
  border-radius: 12px;
  background: #fafbfd;
  color: #12141a;
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.35;
  text-decoration: none;
}

.commerce-bogo[data-bogo-presentation="collapsed"] .commerce-bogo-collapsed-link {
  display: block;
}

.commerce-bogo[data-bogo-presentation="card"] .commerce-bogo-collapsed-link {
  display: none !important;
}

/* —— Below-fold reassure —— */
.commerce-reassure {
  display: none;
  width: 100%;
  max-width: 900px;
  margin: 40px auto 0;
  padding: 8px 4px 48px;
  box-sizing: border-box;
}

html.preview-commerce .commerce-reassure:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.commerce-reassure__block {
  margin: 0;
  padding: 0;
}

.commerce-reassure__header {
  margin: 0 0 16px;
}

.commerce-reassure__title {
  margin: 0 0 8px;
  font-size: clamp(1.35rem, 2.4vw, 1.65rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: #12141a;
}

.commerce-reassure__body {
  margin: 0 0 10px;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.5;
  color: #5a6170;
}

.commerce-reassure__body:last-child {
  margin-bottom: 0;
}

.commerce-media-label {
  display: inline-block;
  margin: 0 0 10px;
  font-size: 0.65rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  color: #5a6170;
}

.commerce-reassure__video-wrap {
  position: relative;
  width: 100%;
  max-width: var(--commerce-physical-media-max-width, 100%);
  margin-inline: auto;
  aspect-ratio: 16 / 10;
  border-radius: 16px;
  overflow: hidden;
  background: #eef1f6;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.commerce-reassure__video {
  width: 100%;
  height: 100%;
  object-fit: var(--holo-media-fit, cover);
  object-position: var(--holo-media-pos, 50% 50%);
  transform: scale(var(--holo-media-scale, 1));
  transform-origin: var(--holo-media-pos, 50% 50%);
  display: block;
  background: #eef1f6;
}

.commerce-reassure__video:not([src]),
.commerce-reassure__video[src=""] {
  display: none;
}

.commerce-reassure__video-empty {
  display: none;
}

/* Guarantee */
.commerce-reassure__block--guarantee {
  padding: 24px 20px;
  border-radius: 16px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.commerce-guarantee-detail,
.commerce-guarantee-link {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .commerce-reassure__video {
    display: none !important;
  }

  .commerce-reassure__video-wrap.has-video {
    display: none !important;
  }

  .commerce-reassure__media:has(.commerce-reassure__video-wrap.has-video) .commerce-reassure__media-placeholder {
    display: flex !important;
  }

  .commerce-reassure__media:has(.commerce-reassure__video-wrap.has-video) .commerce-reassure__media-placeholder span {
    /* keep tasteful static fallback when motion is reduced */
  }
}

/* Receive grid */
.commerce-receive-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.commerce-receive-card {
  padding: 16px;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.commerce-receive-card__title {
  margin: 0 0 6px;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #12141a;
}

.commerce-receive-card__body {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.45;
  color: #5a6170;
}

.commerce-receive-list {
  margin: 0;
  padding: 0 0 0 1.1em;
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.45;
  color: #5a6170;
}

.commerce-receive-note {
  margin: 8px 0 0;
  font-size: 0.78rem;
  color: #8a91a0;
}

.commerce-link-btn {
  display: inline-flex;
  margin: 10px 0 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent, #307fe2);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 650;
  cursor: pointer;
}

/* Steps */
.commerce-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
}

.commerce-steps__item {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 12px;
  align-items: start;
  padding: 0 0 22px;
  position: relative;
}

.commerce-steps__item:last-child {
  padding-bottom: 0;
}

.commerce-steps__item:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 17px;
  top: 36px;
  bottom: 4px;
  width: 2px;
  background: rgba(var(--holo-blue-rgb, 48, 127, 226), 0.18);
}

.commerce-steps__num {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: rgba(var(--holo-blue-rgb, 48, 127, 226), 0.1);
  color: var(--accent, #307fe2);
  font-size: 0.85rem;
  font-weight: 750;
  position: relative;
  z-index: 1;
}

.commerce-steps__title {
  margin: 2px 0 4px;
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #12141a;
}

.commerce-steps__body {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.45;
  color: #5a6170;
}

/* Timeline */
.commerce-timeline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 16px;
}

.commerce-timeline__stage {
  padding: 14px 12px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: #fff;
}

.commerce-timeline__stage[hidden] {
  display: none !important;
}

.commerce-timeline__label {
  display: block;
  margin: 0 0 6px;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #5a6170;
}

.commerce-timeline__value {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #12141a;
  line-height: 1.3;
}

.commerce-timeline__value--ready {
  color: #1b7f4e;
}

.commerce-timeline__eta {
  margin: 0 0 12px;
  padding: 16px;
  border-radius: 14px;
  background: rgba(var(--holo-blue-rgb, 48, 127, 226), 0.06);
  border: 1px solid rgba(var(--holo-blue-rgb, 48, 127, 226), 0.12);
  text-align: center;
  font-size: 0.85rem;
  font-weight: 550;
  color: #5a6170;
  line-height: 1.4;
}

.commerce-timeline__eta strong {
  display: block;
  margin-top: 4px;
  font-size: 1.15rem;
  font-weight: 750;
  color: #12141a;
}

.commerce-timeline__eta[hidden],
.commerce-timeline__note {
  /* note always visible */
}

.commerce-timeline__note {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.45;
  color: #8a91a0;
}

/* Proof */
.commerce-proof-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.commerce-proof-card {
  padding: 16px;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: #fff;
}

.commerce-proof-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.commerce-proof-flow figure {
  margin: 0;
}

.commerce-proof-flow img,
.commerce-proof-flow video {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
  background: #eef1f6;
  display: block;
}

.commerce-proof-flow figcaption {
  margin-top: 6px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #5a6170;
}

.commerce-proof-quote {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.45;
  color: #12141a;
}

.commerce-proof-meta {
  margin: 8px 0 0;
  font-size: 0.8rem;
  color: #5a6170;
}

/* FAQ */
.commerce-faq {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.commerce-faq__item {
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  padding: 0;
}

.commerce-faq__item[hidden] {
  display: none !important;
}

.commerce-faq__item summary {
  cursor: pointer;
  list-style: none;
  padding: 14px 4px;
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: #12141a;
  line-height: 1.35;
}

.commerce-faq__item summary::-webkit-details-marker {
  display: none;
}

.commerce-faq__item summary::after {
  content: "+";
  float: right;
  color: #8a91a0;
  font-weight: 500;
}

.commerce-faq__item[open] summary::after {
  content: "–";
}

.commerce-faq__item p {
  margin: 0 0 14px;
  padding: 0 4px;
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.5;
  color: #5a6170;
}

/* —— Mobile sticky ATC —— */
.commerce-sticky-atc {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 80;
  align-items: center;
  gap: 12px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 -8px 24px rgba(16, 24, 40, 0.08);
  backdrop-filter: blur(10px);
  box-sizing: border-box;
}

html.preview-commerce .commerce-sticky-atc.is-visible:not([hidden]) {
  display: flex;
}

.commerce-sticky-atc__copy {
  flex: 1 1 auto;
  min-width: 0;
}

.commerce-sticky-atc__title {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #12141a;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.commerce-sticky-atc__ship {
  margin: 2px 0 0;
  font-size: 0.7rem;
  font-weight: 500;
  color: #5a6170;
  line-height: 1.25;
}

.commerce-sticky-atc__btn {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.82rem;
  font-weight: 650;
  white-space: nowrap;
}

html.preview-commerce .commerce-sticky-atc.is-visible ~ *,
html.preview-commerce:has(.commerce-sticky-atc.is-visible) .commerce-reassure {
  /* padding handled below */
}

html.preview-commerce:has(.commerce-sticky-atc.is-visible) .canvas-area {
  padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)) !important;
}

/* Hide sticky on desktop purchase card always visible, or when cart dialogs open */
@media (min-width: 901px) {
  .commerce-sticky-atc {
    display: none !important;
  }
}

html:has(#cart-added-dialog[open]) .commerce-sticky-atc,
html:has(#order-dialog[open]) .commerce-sticky-atc,
html.editing-flow .commerce-sticky-atc,
html.editing-flow .commerce-reassure,
html.editing-flow .commerce-compare,
html.editing-flow .commerce-preview-badge {
  display: none !important;
}

@media (max-width: 900px) {
  html.preview-commerce .commerce-panel-ready {
    display: flex !important;
  }

  .commerce-receive-grid,
  .commerce-proof-flow {
    grid-template-columns: 1fr;
  }

  .commerce-reassure {
    margin-top: 28px;
    padding: 0 2px 72px;
    gap: 32px;
  }
}

@media (max-width: 360px) {
  .commerce-sticky-atc__btn .btn-label {
    font-size: 0.75rem;
  }
}
