/**
 * Configurateur Haqihana sur mesure.
 *
 * Les jetons --dvd-* viennent du thème dolcevitadog (css/style.css).
 */

.hq {
  --hq-card: #fff;
  max-width: 1180px;
  margin: 0 auto;
  padding: 8px 0 64px;
  color: var(--dvd-ink, #1f1a17);
}

.hq button { cursor: pointer; }

/* Un seul titre visible, comme sur les fiches produit : le bloc titre de
   page reste pour le référencement, le configurateur porte le sien. */
body:has(.hq) .block-page-title-block {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* En-tête ------------------------------------------------------------ */

.hq-eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--dvd-amber-d);
}

.hq-head h1 {
  margin: 0;
  font: 400 clamp(2rem, 4vw, 2.75rem)/1.1 var(--dvd-serif);
  letter-spacing: -.02em;
}

.hq-lede {
  max-width: 56ch;
  margin: 12px 0 32px;
  color: var(--dvd-muted);
  font-size: 1.05rem;
}

/* Bandeau « 7 millions de possibilités » ------------------------------
   Deux bandes d'images (tools/build_wall.py) posées deux fois à la suite :
   décaler la piste de la moitié de sa largeur boucle sans couture. */

.hq-wall {
  margin: -8px 0 36px;
}

.hq-wall__title {
  margin: 0 0 14px;
  font: 400 clamp(1.15rem, 2.2vw, 1.5rem)/1.3 var(--dvd-serif);
  letter-spacing: -.01em;
}

.hq-wall__title strong { font-weight: 600; }

.hq-wall__row {
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 5%, #000 95%, transparent);
  mask-image: linear-gradient(to right, transparent, #000 5%, #000 95%, transparent);
}

.hq-wall__row + .hq-wall__row { margin-top: 6px; }

.hq-wall__track {
  display: flex;
  width: max-content;
  animation: hq-wall 180s linear infinite;
  will-change: transform;
}

.hq-wall__track img {
  display: block;
  width: auto;
  max-width: none;
  height: 150px;
}

.hq-wall__row--2 .hq-wall__track {
  animation-duration: 210s;
  animation-direction: reverse;
}

.hq-wall:hover .hq-wall__track { animation-play-state: paused; }

@keyframes hq-wall {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@media (max-width: 700px) {
  .hq-wall { margin-bottom: 24px; }
  .hq-wall__row--2 { display: none; }
  .hq-wall__track { animation-duration: 130s; }
  .hq-wall__track img { height: 112px; }
}

@media (prefers-reduced-motion: reduce) {
  .hq-wall__track { animation: none; }
}

/* Mise en page ------------------------------------------------------- */

.hq-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}

.hq-preview {
  position: sticky;
  top: calc(var(--hq-sticky-top, 0px) + 16px);
  background: var(--dvd-card);
  border: 1px solid var(--dvd-line);
  border-radius: var(--dvd-r-lg);
  box-shadow: var(--dvd-shadow);
  padding: 16px 16px 12px;
}

.hq-views {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--dvd-paper);
  border: 1px solid var(--dvd-line);
}

.hq-views button {
  border: 0;
  background: none;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--dvd-muted);
}

.hq-views button[aria-pressed="true"] {
  background: var(--dvd-sage);
  color: #fff;
}

.hq-stage {
  position: relative;
  display: flex;
  justify-content: center;
  margin-top: 8px;
}

.hq-stage canvas {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(100vh - var(--hq-sticky-top, 0px) - 150px);
  object-fit: contain;
}

.hq-preview[data-view="dog"] .hq-stage canvas { max-height: none; }

.hq-preview-msg {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 24px;
  text-align: center;
  color: var(--dvd-muted);
  background: var(--dvd-card);
}

.hq-preview.is-loading .hq-preview-msg,
.hq-preview.is-error .hq-preview-msg { display: flex; }

.hq-note {
  margin: 8px 4px 0;
  font-size: 12px;
  color: var(--dvd-muted);
}

.hq-preview[data-view="flat"] .hq-note--dog,
.hq-preview[data-view="dog"] .hq-note--flat { display: none; }

/* Étapes ------------------------------------------------------------- */

.hq-steps { display: grid; gap: 16px; }

.hq-step {
  background: var(--dvd-card);
  border: 1px solid var(--dvd-line);
  border-radius: var(--dvd-r-lg);
  padding: 22px 22px 24px;
  box-shadow: var(--dvd-shadow-sm);
  transition: opacity .25s;
}

.hq:not(.has-size) .hq-step--locked {
  opacity: .45;
  pointer-events: none;
}

.hq-step h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  font: 400 1.4rem/1.2 var(--dvd-serif);
  letter-spacing: -.02em;
}

.hq-num {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--dvd-sage);
  color: #fff;
  font: 600 13px/1 var(--dvd-sans);
}

.hq-label {
  margin: 18px 0 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--dvd-muted);
}

.hq-label:first-of-type { margin-top: 0; }

.hq-muted { margin: 10px 0 0; font-size: 13px; color: var(--dvd-muted); }

/* Tailles */

.hq-sizes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
}

.hq-size {
  position: relative;
  display: grid;
  gap: 2px;
  padding: 10px 6px;
  border: 1px solid var(--dvd-border);
  border-radius: var(--dvd-r);
  background: var(--dvd-card);
  text-align: center;
  transition: border-color .15s, background .15s;
}

.hq-size:hover { border-color: var(--dvd-sage); }

.hq-size__key { font-weight: 600; font-size: 15px; }
.hq-size__range { font-size: 11px; color: var(--dvd-muted); }

.hq-size[aria-pressed="true"] {
  background: var(--dvd-sage);
  border-color: var(--dvd-sage);
  color: #fff;
}

.hq-size[aria-pressed="true"] .hq-size__range { color: rgba(255, 255, 255, .75); }

.hq-size.is-reco::after {
  content: "conseillée";
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--dvd-amber);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.hq-measure { margin-top: 14px; font-size: 14px; }

.hq-measure summary {
  cursor: pointer;
  color: var(--dvd-sage);
  font-weight: 500;
}

.hq-measure label { display: block; margin: 10px 0 6px; color: var(--dvd-muted); font-size: 13px; }

.hq-measure__row { display: flex; align-items: center; gap: 8px; }

.hq-measure input[type="text"] {
  width: 110px;
  padding: 8px 10px;
  border: 1px solid var(--dvd-border);
  border-radius: var(--dvd-r-sm);
  background: #fff;
}

.hq-measure__result { margin: 8px 0 0; font-size: 13px; }

.hq-specs { margin: 14px 0 0; font-size: 14px; }
.hq-specs:empty { display: none; }

/* Dorsale */

.hq-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.hq-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--dvd-border);
  border-radius: var(--dvd-r);
  cursor: pointer;
}

.hq-option:has(input:checked) { border-color: var(--dvd-sage); background: var(--dvd-sage-wash); }
.hq-option:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.hq-option input { margin-top: 3px; accent-color: var(--dvd-sage); }
.hq-option span { display: grid; }
.hq-option small { color: var(--dvd-muted); font-size: 12px; }

/* Pastilles */

.hq-chip {
  --c: #999;
  display: inline-block;
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  /* Évoque le tissage de la sangle. */
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .10) 0 1px, rgba(0, 0, 0, .08) 1px 3px),
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .28), transparent 60%),
    var(--c);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
}

.hq-palette {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 6px;
}

.hq-swatch {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 6px 2px;
  border: 1px solid transparent;
  border-radius: var(--dvd-r);
  background: none;
}

.hq-swatch .hq-chip { width: 32px; height: 32px; }

.hq-swatch__name {
  font-size: 10.5px;
  line-height: 1.2;
  color: var(--dvd-muted);
  text-align: center;
}

.hq-swatch:hover { background: var(--dvd-paper); }

.hq-swatch[aria-pressed="true"] { border-color: var(--dvd-sage); background: var(--dvd-sage-wash); }
.hq-swatch[aria-pressed="true"] .hq-swatch__name { color: var(--dvd-ink); font-weight: 600; }

/* Idées */

.hq-presets { display: flex; flex-wrap: wrap; gap: 8px; }

.hq-preset {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--dvd-border);
  border-radius: 999px;
  background: var(--dvd-card);
  font-size: 13px;
  font-weight: 500;
}

.hq-preset:hover { border-color: var(--dvd-sage); }

.hq-preset__chips { display: inline-flex; }
.hq-preset__chips .hq-chip { width: 14px; height: 22px; border-radius: 0; box-shadow: none; }
.hq-preset__chips .hq-chip:first-child { border-radius: 999px 0 0 999px; }
.hq-preset__chips .hq-chip:last-child { border-radius: 0 999px 999px 0; }

.hq-preset__chips--dice {
  width: 22px;
  height: 22px;
  place-items: center;
  justify-content: center;
  border-radius: 50%;
  background: conic-gradient(#e40207, #e8a71b, #f1d705, #5b6e3d, #06b8b3, #414c79, #773a7d, #e27db3, #e40207);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .4);
}

/* Sangles */

.hq-zones {
  border: 1px solid var(--dvd-line);
  border-radius: var(--dvd-r);
  overflow: hidden;
}

.hq-zone + .hq-zone { border-top: 1px solid var(--dvd-line); }

.hq-zone__head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  background: var(--dvd-card);
  text-align: left;
}

.hq-zone__head:hover,
.hq-zone.is-open .hq-zone__head { background: var(--dvd-paper); }

.hq-zone__letter {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--dvd-ink);
  font: 600 13px/1 var(--dvd-sans);
}

.hq-zone__text { display: grid; min-width: 0; }
.hq-zone__name { font-weight: 600; }
.hq-zone__hint { font-size: 12.5px; color: var(--dvd-muted); }

.hq-zone__value {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.hq-zone__value::after {
  content: "";
  width: 7px;
  height: 7px;
  margin-left: 4px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform .2s;
}

.hq-zone.is-open .hq-zone__value::after { transform: rotate(-135deg) translateY(-1px); }

.hq-zone .hq-palette { padding: 4px 12px 14px; background: var(--dvd-paper); }

.hq-toggle,
.hq-consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 14px;
  font-size: 14px;
  cursor: pointer;
}

.hq-toggle input,
.hq-consent input { margin-top: 3px; accent-color: var(--dvd-sage); }

/* Récapitulatif */

.hq-recap {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
}

.hq-recap li { padding: 6px 0; border-bottom: 1px dashed var(--dvd-line); }

.hq-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

.hq-btn {
  padding: 12px 20px;
  border-radius: var(--dvd-r-sm);
  font-weight: 600;
  border: 1px solid var(--dvd-sage);
}

.hq-btn--primary { background: var(--dvd-sage); color: #fff; }
.hq-btn--primary:hover { background: var(--dvd-sage-d); }
.hq-btn--ghost { background: transparent; color: var(--dvd-sage); }
.hq-btn--ghost:hover { background: var(--dvd-sage-wash); }

.hq-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: var(--dvd-r);
  background: var(--dvd-ink);
  color: #fff;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}

.hq-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

:focus-visible { outline: 2px solid var(--dvd-amber); outline-offset: 2px; }

/* Mobile ------------------------------------------------------------- */

@media (max-width: 900px) {
  .hq { padding: 24px 16px 64px; }
  .hq-layout { grid-template-columns: 1fr; gap: 16px; }
  .hq-preview {
    top: var(--hq-sticky-top, 0px);
    z-index: 5;
    padding: 10px;
    border-radius: 0 0 var(--dvd-r-lg) var(--dvd-r-lg);
    margin: 0 -16px;
  }
  .hq-stage canvas { max-height: 30vh; width: auto; max-width: 100%; }
  .hq-preview[data-view="dog"] .hq-stage canvas { max-height: 30vh; }
  .hq-note { display: none; }
  .hq-palette { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .hq-zone__hint { display: none; }
  .hq-step { padding: 18px 16px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* Formulaires Drupal dans l'étape 4 ---------------------------------- */

.hq-price {
  margin: 18px 0 4px;
  font-size: 1.85rem;
  font-weight: 600;
  line-height: 1.2;
}

.hq-price-note {
  margin: 0 0 12px;
  font-size: .875rem;
  line-height: 1.45;
  color: var(--dvd-muted, #7a736b);
}

.hq-spots {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--dvd-amber-d, #a97f34);
}

.hq-spots__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dvd-amber, #c89b4c);
  box-shadow: 0 0 0 4px rgba(200, 155, 76, .2);
}

.hq-notice {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: var(--dvd-r, 8px);
  background: var(--dvd-sage-wash, #dde5f0);
  font-size: 14px;
}

.hq-notice--ok { background: #e6f0e1; }

.hq-form { margin-top: 16px; }
.hq-form .form-item { margin-bottom: 12px; }
.hq-form .form-actions { margin-top: 16px; }
.hq-form .hq-btn { width: 100%; padding: 12px 20px; font-weight: 600; }
.hq-form .form-check-label,
.hq-form .option { font-size: 14px; }

/* Liste d'attente : comment ça marche. */
.hq-waitlist-how {
  margin: 16px 0 0;
  padding: 12px 14px;
  border: 1px dashed var(--dvd-border, rgba(31, 26, 23, .18));
  border-radius: var(--dvd-r, 8px);
  font-size: 14px;
}

.hq-waitlist-how__title { margin: 0 0 6px; font-weight: 600; }
.hq-waitlist-how ol { margin: 0; padding-left: 20px; }
.hq-waitlist-how li { margin-bottom: 4px; }
