/*!
 * Product Configurator — core styles
 * Platform-agnostic. Everything is scoped under .pcfg to survive
 * WordPress themes and other host environments.
 */

.pcfg {
  /* ---- Design tokens (override these to retheme) ---- */
  --pcfg-bg: #141414;
  --pcfg-stage-bg: #1b1b1b;
  --pcfg-surface: #1e1e1e;
  --pcfg-surface-hover: #292929;
  --pcfg-text: #f5f5f4;
  --pcfg-text-muted: #a3a3a3;
  --pcfg-border: #2a2a2a;
  --pcfg-border-strong: #3d3d3d;
  --pcfg-accent: #fafafa;          /* primary CTA / check marks */
  --pcfg-accent-contrast: #141414;
  --pcfg-selected-border: #444444; /* border of checked options */
  --pcfg-focus: #60a5fa;
  --pcfg-danger: #f87171;
  --pcfg-radius: 5px;
  --pcfg-radius-sm: 5px;
  --pcfg-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  --pcfg-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  --pcfg-summary-h: 72px;

  font-family: var(--pcfg-font);
  color: var(--pcfg-text);
  background: var(--pcfg-bg);
  line-height: 1.5;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  box-sizing: border-box;
  position: relative;
}

.pcfg *,
.pcfg *::before,
.pcfg *::after {
  box-sizing: inherit;
  margin: 0;
  padding: 0;
}

.pcfg button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

.pcfg :focus-visible {
  outline: 2px solid var(--pcfg-focus);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- layout */

.pcfg__layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(360px, 1fr);
  min-height: 640px;
}

/* grid items default to min-width:auto, which lets intrinsically wide
   children (inputs, nowrap prices) blow the track out past the container —
   pin them so the layout stays inside its box at every width */
.pcfg__layout > * { min-width: 0; }

.pcfg__field input,
.pcfg__field textarea { width: 100%; min-width: 0; }

/* ---------------------------------------------------------------- stage */

.pcfg__stage {
  position: sticky;
  top: 0;
  align-self: start;
  height: min(100vh, 860px);
  display: flex;
  flex-direction: column;
  background: var(--pcfg-stage-bg);
  overflow: hidden;
}

.pcfg__stage-head {
  padding: 40px 48px 0;
}

.pcfg__kicker {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pcfg-text-muted);
  margin-bottom: 6px;
}

.pcfg__product-name {
  font-size: clamp(26px, 3vw, 38px);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.pcfg__stage-canvas {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 48px 48px;
  min-height: 0;
}

.pcfg__stage-canvas img,
.pcfg__stage-canvas svg {
  max-width: 100%;
  max-height: 100%;
  transition: opacity 300ms ease;
}

.pcfg__stage-canvas.is-swapping img,
.pcfg__stage-canvas.is-swapping svg {
  opacity: 0;
}

/* layered image preview: a stack of image + tint-mask layers */
.pcfg__layers {
  position: relative;
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  aspect-ratio: 800 / 520;
}
.pcfg__layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transition: opacity 260ms ease, background-color 260ms ease;
}
img.pcfg__layer { object-fit: contain; }
.pcfg__layer--tint {
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

.pcfg__stage-caption {
  padding: 0 48px 28px;
  font-size: 14px;
  color: var(--pcfg-text-muted);
  min-height: 1.5em;
}

/* ---------------------------------------------------------------- panel */

.pcfg__panel {
  background: var(--pcfg-bg);
  padding-bottom: calc(var(--pcfg-summary-h) + 24px);
}

.pcfg__steps-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  gap: 4px;
  padding: 16px 32px 12px;
  background: color-mix(in srgb, var(--pcfg-bg) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--pcfg-border);
  overflow-x: auto;
  scrollbar-width: none;
}

.pcfg__steps-nav::-webkit-scrollbar { display: none; }

.pcfg__step-tab {
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: var(--pcfg-radius);
  font-size: 14px;
  font-weight: 500;
  color: var(--pcfg-text-muted);
  transition: color 200ms ease, background-color 200ms ease;
  white-space: nowrap;
}

.pcfg__step-tab:hover { color: var(--pcfg-text); }

.pcfg__step-tab.is-active {
  background: var(--pcfg-accent);
  color: var(--pcfg-accent-contrast);
}

.pcfg__sections {
  padding: 8px 32px 40px;
}

.pcfg__section { padding-top: 28px; }

/* inline per-section preview — mobile only (desktop uses the sticky stage) */
.pcfg__section-preview { display: none; }

.pcfg__section + .pcfg__section {
  margin-top: 28px;
  border-top: 1px solid var(--pcfg-border);
}

.pcfg__section-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.pcfg__section-desc {
  margin-top: 4px;
  font-size: 14px;
  color: var(--pcfg-text-muted);
  max-width: 46ch;
}

.pcfg__group {
  margin-top: 20px;
  border: 1px solid var(--pcfg-border);
  border-radius: var(--pcfg-radius);
  padding: 16px 18px 18px;
}

.pcfg__group-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
}

.pcfg__group-selected {
  font-size: 13px;
  font-weight: 400;
  color: var(--pcfg-text-muted);
  text-align: right;
}

/* ---------------------------------------------------------------- swatches */

.pcfg__swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.pcfg__swatch {
  width: 44px;
  height: 44px;
  border-radius: var(--pcfg-radius);
  border: 1px solid var(--pcfg-border-strong);
  position: relative;
  transition: transform 200ms ease, box-shadow 200ms ease;
}

.pcfg__swatch::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: calc(var(--pcfg-radius) + 4px);
  border: 2px solid transparent;
  transition: border-color 200ms ease;
}

.pcfg__swatch:hover { box-shadow: var(--pcfg-shadow); }

.pcfg__swatch.is-selected::after { border-color: var(--pcfg-selected-border); border-width: 1px; }

/* ---------------------------------------------------------------- option cards */

.pcfg__cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.pcfg__cards--two { grid-template-columns: repeat(2, 1fr); }

.pcfg__card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  width: 100%;
  min-width: 0;
  padding: 16px 18px;
  background: var(--pcfg-surface);
  border: 1px solid transparent;
  border-radius: var(--pcfg-radius);
  transition: border-color 200ms ease, box-shadow 200ms ease, opacity 200ms ease;
}

.pcfg__card:hover {
  border-color: var(--pcfg-border-strong);
  background: var(--pcfg-surface-hover);
}

.pcfg__card.is-selected {
  border-color: var(--pcfg-selected-border);
}

/* distinguish chosen vs still-open: mute the options that aren't selected,
   so the taken one stands out. An un-chosen option brightens on hover/focus
   so it stays fully readable while you're deciding. */
.pcfg__card:not(.is-selected):not(.is-disabled) {
  opacity: 0.5;
}
.pcfg__card:not(.is-selected):not(.is-disabled):hover,
.pcfg__card:not(.is-selected):not(.is-disabled):focus-within {
  opacity: 1;
}
.pcfg__card.is-selected { opacity: 1; }

.pcfg__card.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.pcfg__card-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 12px;
  min-width: 0;
}

.pcfg__card-title { flex: 1 1 auto; min-width: 0; }

.pcfg__card-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.pcfg__card-title { font-size: 15px; font-weight: 600; }

.pcfg__card-price {
  font-size: 14px;
  font-weight: 500;
  color: var(--pcfg-text-muted);
  white-space: nowrap;
}

.pcfg__card-desc {
  font-size: 13px;
  color: var(--pcfg-text-muted);
}

.pcfg__card-note {
  font-size: 12px;
  color: var(--pcfg-danger);
}

.pcfg__card-check {
  --size: 20px;
  flex: 0 0 var(--size);
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  border: 1.5px solid var(--pcfg-border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 200ms ease, border-color 200ms ease;
  align-self: center;
}

.pcfg__card--addon { flex-direction: row; align-items: center; gap: 14px; }

.pcfg__card--addon .pcfg__card-check { order: -1; border-radius: var(--pcfg-radius); }

/* embedded color picker for "any color" options */
.pcfg__card-picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

.pcfg__card-picker-label {
  font-size: 13px;
  color: var(--pcfg-text-muted);
}

.pcfg__card-picker {
  appearance: none;
  -webkit-appearance: none;
  width: 34px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--pcfg-border-strong);
  border-radius: var(--pcfg-radius);
  background: none;
  cursor: pointer;
  align-self: center;
}

.pcfg__card-picker::-webkit-color-swatch-wrapper { padding: 2px; }
.pcfg__card-picker::-webkit-color-swatch {
  border: none;
  border-radius: calc(var(--pcfg-radius) - 2px);
}
.pcfg__card-picker::-moz-color-swatch {
  border: none;
  border-radius: calc(var(--pcfg-radius) - 2px);
}

.pcfg__card--addon .pcfg__card-body { flex: 1; min-width: 0; }

.pcfg__card.is-selected .pcfg__card-check {
  background: var(--pcfg-accent);
  border-color: var(--pcfg-accent);
}

.pcfg__card-check svg {
  width: 12px;
  height: 12px;
  stroke: var(--pcfg-accent-contrast);
  opacity: 0;
  transition: opacity 150ms ease;
}

.pcfg__card.is-selected .pcfg__card-check svg { opacity: 1; }

/* ---------------------------------------------------------------- summary section */

.pcfg__summary-list {
  margin-top: 20px;
  border: 1px solid var(--pcfg-border);
  border-radius: var(--pcfg-radius);
  background: var(--pcfg-surface);
  overflow: hidden;
}

.pcfg__summary-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  font-size: 14px;
}

.pcfg__summary-item + .pcfg__summary-item {
  border-top: 1px solid var(--pcfg-border);
}

.pcfg__summary-item dt { color: var(--pcfg-text-muted); }
.pcfg__summary-item dd { text-align: right; font-weight: 500; }
/* the three price totals, boxed off on their own for emphasis */
.pcfg__totals {
  margin-top: 12px;
  border: 1.5px solid var(--pcfg-border-strong);
  border-radius: var(--pcfg-radius);
  background: var(--pcfg-surface-hover);
  overflow: hidden;
}
.pcfg__totals .pcfg__summary-item + .pcfg__summary-item {
  border-top: 1px solid var(--pcfg-border);
}
.pcfg__totals .pcfg__summary-item--total { background: transparent; }

.pcfg__summary-item--sub {
  font-size: 13px;
  color: var(--pcfg-text-muted);
}
.pcfg__summary-item--sub dt { color: var(--pcfg-text-muted); }
.pcfg__summary-item--total {
  font-size: 16px;
  font-weight: 700;
  background: var(--pcfg-stage-bg);
}
.pcfg__summary-item--total dt { color: var(--pcfg-text); }

/* VAT / MwSt explainer under the price summary */
.pcfg__tax-note {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--pcfg-border);
  border-radius: var(--pcfg-radius);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--pcfg-text-muted);
}

/* ---------------------------------------------------------------- order form */

.pcfg__form { margin-top: 24px; display: grid; gap: 14px; }

.pcfg__field { display: grid; gap: 6px; }

.pcfg__field label { font-size: 13px; font-weight: 600; }

.pcfg__field input,
.pcfg__field textarea {
  font: inherit;
  font-size: 15px;
  color: var(--pcfg-text);
  background: var(--pcfg-surface);
  border: 1px solid var(--pcfg-border-strong);
  border-radius: var(--pcfg-radius-sm);
  padding: 12px 14px;
  transition: border-color 200ms ease;
}

.pcfg__field input:focus,
.pcfg__field textarea:focus {
  border-color: var(--pcfg-accent);
  outline: none;
}

.pcfg__field-error {
  font-size: 12px;
  color: var(--pcfg-danger);
  display: none;
}

.pcfg__field.has-error input,
.pcfg__field.has-error textarea { border-color: var(--pcfg-danger); }
.pcfg__field.has-error .pcfg__field-error { display: block; }

.pcfg__submit {
  margin-top: 6px;
  padding: 15px 24px;
  border-radius: var(--pcfg-radius);
  background: var(--pcfg-accent);
  color: var(--pcfg-accent-contrast);
  font-size: 16px;
  font-weight: 600;
  transition: opacity 200ms ease, transform 200ms ease;
}

.pcfg__submit:hover { opacity: 0.88; }
.pcfg__submit:disabled { opacity: 0.5; cursor: default; }

.pcfg__form-status {
  font-size: 14px;
  min-height: 1.5em;
}
.pcfg__form-status.is-error { color: var(--pcfg-danger); }

.pcfg__success {
  margin-top: 24px;
  padding: 32px 24px;
  border-radius: var(--pcfg-radius);
  background: var(--pcfg-surface);
  border: 1px solid var(--pcfg-border);
  text-align: center;
}

.pcfg__success h3 { font-size: 20px; margin-bottom: 6px; }
.pcfg__success p { color: var(--pcfg-text-muted); font-size: 14px; }

/* ---------------------------------------------------------------- price bar */

.pcfg__bar {
  position: sticky;
  bottom: 0;
  z-index: 30;
  margin-top: calc(-1 * var(--pcfg-summary-h));
  height: var(--pcfg-summary-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 32px;
  background: color-mix(in srgb, var(--pcfg-surface) 90%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--pcfg-border);
}

.pcfg__bar-price { display: flex; flex-direction: column; }

.pcfg__bar-total {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.pcfg__bar-hint { font-size: 12px; color: var(--pcfg-text-muted); }

.pcfg__bar-cta {
  padding: 12px 26px;
  border-radius: var(--pcfg-radius);
  background: var(--pcfg-accent);
  color: var(--pcfg-accent-contrast);
  font-size: 15px;
  font-weight: 600;
  transition: opacity 200ms ease;
  white-space: nowrap;
}

.pcfg__bar-cta:hover { opacity: 0.88; }

/* price change flash */
@keyframes pcfg-price-pulse {
  0% { transform: translateY(2px); opacity: 0.4; }
  100% { transform: translateY(0); opacity: 1; }
}
.pcfg__bar-total.is-updated {
  animation: pcfg-price-pulse 300ms ease;
}

/* ---------------------------------------------------------------- responsive */

@media (max-width: 960px) {
  .pcfg__layout { grid-template-columns: 1fr; }

  /* the sticky stage gives way to an inline preview above each step:
     the images sit in the flow and you scroll past them, each one
     updating live with the current configuration */
  .pcfg__stage { display: none; }

  .pcfg__section-preview {
    display: block;
    margin-bottom: 18px;
    padding: 10px 14px;
    background: var(--pcfg-stage-bg);
    border: 1px solid var(--pcfg-border);
    border-radius: var(--pcfg-radius);
  }

  .pcfg__steps-nav { position: static; padding: 12px 20px 10px; }
  .pcfg__sections { padding: 4px 20px 32px; }
  .pcfg__cards--two { grid-template-columns: 1fr; }
  .pcfg__bar { padding: 0 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .pcfg *,
  .pcfg *::before,
  .pcfg *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
