/* Imagine3D customiser — scoped to .cz-* (uses the site tokens with safe fallbacks). */

.cz-stage, .cz-panel, .cz-hero {
  --cz-navy: var(--navy, #14213D);
  --cz-navy-2: var(--navy-2, #2E4170);
  --cz-gold: var(--gold, #C68B3E);
  --cz-mist: var(--mist, #EEF1F6);
  --cz-line: var(--line, #DDE2EA);
  --cz-ink-soft: var(--ink-soft, #55607A);
  --cz-radius-img: var(--radius-img, 18px);
  --cz-radius-input: var(--radius-input, 12px);
  font-family: Outfit, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--cz-navy);
  box-sizing: border-box;
}
.cz-stage *, .cz-panel *, .cz-hero * { box-sizing: border-box; }

.cz-sr {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

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

.cz-stage { position: relative; min-width: 0; }
.cz-viewport {
  position: relative; width: 100%; aspect-ratio: 1 / 1; min-height: 320px;
  border-radius: var(--cz-radius-img); background: var(--cz-mist); overflow: hidden;
  isolation: isolate; touch-action: none;
  transition: background-color .5s ease;
}
.cz-viewport::before { /* lit-mode backdrop, cross-faded */
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0; transition: opacity .6s ease;
  background: radial-gradient(120% 90% at 50% 38%, #34477a 0%, #1b2a4d 45%, #10192f 100%);
}
.cz-stage.is-lit .cz-viewport::before { opacity: 1; }
.cz-canvas { display: block; width: 100% !important; height: 100% !important; outline: none; cursor: grab; }
.cz-canvas:active { cursor: grabbing; }
.cz-canvas:focus-visible { box-shadow: inset 0 0 0 3px var(--cz-gold); border-radius: var(--cz-radius-img); }

.cz-fallback-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.cz-loading {
  position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 12px;
  font-size: 15px; color: var(--cz-ink-soft); pointer-events: none; transition: opacity .35s ease;
}
.cz-stage[data-state="ready"] .cz-loading { opacity: 0; }
.cz-spinner {
  width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--cz-line); border-top-color: var(--cz-gold);
  animation: cz-spin 0.9s linear infinite;
}
@keyframes cz-spin { to { transform: rotate(360deg); } }
.cz-busy {
  position: absolute; top: 14px; left: 14px; width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid rgba(20, 33, 61, .15); border-top-color: var(--cz-gold); opacity: 0;
  animation: cz-spin .8s linear infinite; transition: opacity .2s ease; pointer-events: none;
}
.cz-stage.is-busy .cz-busy { opacity: 1; }

.cz-tools { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.cz-tool {
  appearance: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px;
  border: 1px solid var(--cz-line); border-radius: 999px; background: rgba(255, 255, 255, .92);
  color: var(--cz-navy); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer;
  box-shadow: 0 2px 10px rgba(20, 33, 61, .08); backdrop-filter: blur(6px);
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.cz-tool:hover { border-color: var(--cz-navy); }
.cz-tool:focus-visible { outline: 3px solid var(--cz-gold); outline-offset: 2px; }
.cz-tool svg { width: 18px; height: 18px; flex: none; }
.cz-tool[aria-pressed="true"] { background: var(--cz-gold); border-color: var(--cz-gold); color: #fff; }
.cz-hint {
  position: absolute; left: 14px; bottom: 16px; margin: 0; font-size: 13px; color: var(--cz-ink-soft);
  pointer-events: none; transition: opacity .4s ease;
}
.cz-stage.is-lit .cz-hint { color: rgba(255, 255, 255, .7); }
.cz-stage.has-interacted .cz-hint { opacity: 0; }
@media (max-width: 420px) { .cz-hint { display: none; } }

.cz-dims { margin: 10px 2px 0; font-size: 14px; color: var(--cz-ink-soft); display: flex; gap: 8px; align-items: center; }
.cz-dims svg { width: 16px; height: 16px; flex: none; }
.cz-note { margin: 8px 2px 0; font-size: 14px; color: var(--cz-ink-soft); }

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

.cz-panel { display: grid; gap: 22px; margin: 4px 0 20px; min-width: 0; }
.cz-panel__title { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.cz-field { margin: 0; padding: 0; border: 0; min-width: 0; display: grid; gap: 8px; }
.cz-field__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.cz-label, .cz-field legend { padding: 0; font-size: 15px; font-weight: 600; color: var(--cz-navy); }
.cz-field legend { margin-bottom: 8px; float: left; width: 100%; }
.cz-field legend + * { clear: both; }
.cz-chosen { font-weight: 400; color: var(--cz-ink-soft); margin-left: 6px; }
.cz-optional { font-weight: 400; color: var(--cz-ink-soft); }
.cz-count { font-size: 13px; color: var(--cz-ink-soft); font-variant-numeric: tabular-nums; }
.cz-count.is-max { color: var(--cz-gold); font-weight: 600; }
.cz-help { margin: 0; font-size: 13px; color: var(--cz-ink-soft); }
.cz-field__hint {
  margin: 0; padding: 8px 12px; font-size: 13px; line-height: 1.45; color: var(--cz-ink-soft);
  background: var(--cz-mist); border-radius: 10px; border-left: 3px solid var(--cz-gold);
}
.cz-field legend ~ .cz-field__hint { clear: both; margin-top: 2px; }

.cz-input, .cz-textarea {
  width: 100%; min-height: 48px; padding: 11px 14px; border: 1px solid var(--cz-line); border-radius: var(--cz-radius-input);
  background: #fff; color: var(--cz-navy); font: inherit; font-size: 16px; line-height: 1.4;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.cz-textarea { min-height: 132px; resize: vertical; }
.cz-input:hover, .cz-textarea:hover { border-color: #b9c1cf; }
.cz-input:focus, .cz-textarea:focus { outline: none; border-color: var(--cz-navy); box-shadow: 0 0 0 3px rgba(198, 139, 62, .35); }
.cz-field.has-error .cz-input, .cz-field.has-error .cz-textarea { border-color: #B3261E; }
.cz-error { margin: 0; font-size: 13px; color: #B3261E; }

/* fonts */
.cz-fonts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 560px) { .cz-fonts { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.cz-font { position: relative; display: grid; gap: 2px; padding: 10px 12px 9px; border: 1px solid var(--cz-line); border-radius: var(--cz-radius-input); background: #fff; cursor: pointer; transition: border-color .15s ease, background-color .15s ease; }
.cz-font:hover { border-color: #b9c1cf; }
.cz-font input { position: absolute; opacity: 0; pointer-events: none; }
.cz-font__sample { font-size: 22px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--cz-navy); }
.cz-font__name { font-size: 12px; color: var(--cz-ink-soft); }
.cz-font:has(input:checked) { border-color: var(--cz-navy); box-shadow: inset 0 0 0 1px var(--cz-navy); background: #fbfcfe; }
.cz-font:has(input:focus-visible) { outline: 3px solid var(--cz-gold); outline-offset: 2px; }

/* colour swatches */
.cz-swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.cz-swatch { position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; cursor: pointer; }
.cz-swatch input { position: absolute; opacity: 0; pointer-events: none; }
.cz-swatch__dot {
  width: 34px; height: 34px; border-radius: 50%; background: var(--sw, #ccc);
  box-shadow: inset 0 0 0 1px rgba(20, 33, 61, .14), inset 0 -3px 6px rgba(0, 0, 0, .08);
  transition: transform .15s ease, box-shadow .15s ease;
}
.cz-swatch:hover .cz-swatch__dot { transform: scale(1.06); }
.cz-swatch input:checked + .cz-swatch__dot { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--cz-navy); }
.cz-swatch input:focus-visible + .cz-swatch__dot { outline: 3px solid var(--cz-gold); outline-offset: 5px; }
.cz-swatch__dot[data-finish="silk"] { box-shadow: inset 0 0 0 1px rgba(20, 33, 61, .12), inset 0 1px 0 rgba(255, 255, 255, .6); }
.cz-swatch__dot[data-finish="translucent"] { box-shadow: inset 0 0 0 1px rgba(20, 33, 61, .12), 0 0 10px rgba(255, 196, 120, .55); }
.cz-swatch__dot[data-finish="glow"] { box-shadow: inset 0 0 0 1px rgba(20, 33, 61, .12), 0 0 9px rgba(160, 240, 120, .65); }
.cz-swatch__badge { position: absolute; right: -2px; top: -2px; font-size: 9px; line-height: 1; padding: 3px 4px; border-radius: 6px; background: var(--cz-navy); color: #fff; letter-spacing: .02em; pointer-events: none; }

/* segmented choices */
.cz-seg { display: flex; flex-wrap: wrap; gap: 8px; }
.cz-seg__opt { position: relative; cursor: pointer; }
.cz-seg__opt input { position: absolute; opacity: 0; pointer-events: none; }
.cz-seg__opt span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border: 1px solid var(--cz-line);
  border-radius: 999px; background: #fff; font-size: 15px; transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.cz-seg__opt:hover span { border-color: #b9c1cf; }
.cz-seg__opt input:checked + span { background: var(--cz-navy); border-color: var(--cz-navy); color: #fff; }
.cz-seg__opt input:focus-visible + span { outline: 3px solid var(--cz-gold); outline-offset: 2px; }

/* image upload */
.cz-drop { position: relative; border: 1.5px dashed #b9c1cf; border-radius: var(--cz-radius-input); background: #fff; transition: border-color .15s ease, background-color .15s ease; }
.cz-drop.is-over { border-color: var(--cz-gold); background: #fffaf3; }
.cz-file { position: absolute; width: 1px; height: 1px; opacity: 0; }
.cz-drop__label { display: grid; justify-items: center; gap: 4px; padding: 22px 16px; text-align: center; cursor: pointer; font-size: 15px; }
.cz-drop__label svg { width: 28px; height: 28px; color: var(--cz-gold); margin-bottom: 4px; }
.cz-drop__label small { font-size: 13px; color: var(--cz-ink-soft); }
.cz-link { color: var(--cz-navy); text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
.cz-file:focus-visible + .cz-drop__label { outline: 3px solid var(--cz-gold); outline-offset: 2px; border-radius: var(--cz-radius-input); }
.cz-drop.is-filled .cz-drop__label { display: none; }
.cz-photo { display: none; grid-template-columns: 112px 1fr; gap: 14px; padding: 12px; align-items: center; }
.cz-drop.is-filled .cz-photo { display: grid; }
.cz-photo__crop { width: 112px; height: 112px; border-radius: 10px; background: var(--cz-mist); overflow: hidden; display: grid; place-items: center; touch-action: none; cursor: move; }
.cz-photo__crop canvas { max-width: 100%; max-height: 100%; display: block; }
.cz-photo__meta { display: grid; gap: 6px; font-size: 14px; min-width: 0; }
.cz-photo__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--cz-ink-soft); }
.cz-photo__actions { display: flex; gap: 14px; flex-wrap: wrap; }
.cz-textbtn { appearance: none; border: 0; background: none; padding: 4px 0; font: inherit; font-size: 14px; font-weight: 600; color: var(--cz-navy); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.cz-textbtn:focus-visible { outline: 3px solid var(--cz-gold); outline-offset: 2px; border-radius: 4px; }
.cz-crop { display: grid; gap: 10px; margin-top: 4px; }
.cz-crop[hidden] { display: none; }
.cz-range { display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 10px; font-size: 14px; color: var(--cz-ink-soft); }
.cz-range input[type="range"] { width: 100%; accent-color: var(--cz-navy); min-height: 32px; }

.cz-status { margin: 0; min-height: 1em; font-size: 14px; color: var(--cz-ink-soft); }
.cz-status.is-error { color: #B3261E; }

/* ------------------------------------------------------------------ hero */

.cz-hero { position: absolute; inset: 0; z-index: 0; }
.cz-hero.is-inline { position: relative; inset: auto; width: 100%; height: 100%; min-height: 240px; }
.cz-hero canvas { display: block; width: 100% !important; height: 100% !important; }
.cz-hero__poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transition: opacity .6s ease; pointer-events: none; }
.cz-hero canvas { touch-action: pan-y; cursor: grab; }
.cz-hero__hint {
  position: absolute; left: 50%; top: 7%; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, .88); border: 1px solid var(--cz-line);
  color: var(--cz-ink-soft); font-size: 13px; font-weight: 500; line-height: 1; white-space: nowrap; pointer-events: none;
  box-shadow: 0 2px 10px rgba(20, 33, 61, .06); opacity: 0; transition: opacity .5s ease .4s;
}
.cz-hero__hint svg { width: 16px; height: 16px; color: var(--cz-gold); }
.cz-hero.is-ready .cz-hero__hint { opacity: 1; }
.cz-hero.has-interacted .cz-hero__hint { opacity: 0; transition-delay: 0s; }
.cz-hero.is-ready .cz-hero__poster { opacity: 0; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .cz-spinner, .cz-busy { animation-duration: 2.4s; }
  .cz-viewport, .cz-viewport::before, .cz-tool, .cz-loading, .cz-hero__hint { transition: none; }
}
