/* =========================================================
   Stixiva — couture : le curseur aiguille et les effets brodés des boutons
   Chargé avec la navigation du site (site-tools/site-nav.ts) sur toutes ses pages.
   couture.js pose sur <html> :
     .cx           effets des boutons (mouvements autorisés)
     .cx-aiguille  l'aiguille remplace le pointeur (souris, mouvements autorisés)
   Sans script, ou si l'appareil demande moins d'animations, rien ne change
   sauf la couleur de la sélection.
   ========================================================= */

/* Sélection de texte aux couleurs du fil */
::selection {
  background: #f4c4d0;
  color: #3d1727;
}

/* ---------- Le pointeur ---------- */
html.cx-aiguille,
html.cx-aiguille * {
  cursor: none !important;
}

html.cx-aiguille *:is(input:not([type='button'], [type='submit'], [type='reset'], [type='checkbox'], [type='radio'], [type='range'], [type='color'], [type='file']), textarea, select, [contenteditable]:not([contenteditable='false'])) {
  cursor: auto !important;
}

.cx-layer,
.cx-needle,
.cx-dot,
.cx-pique {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
  z-index: 2147483646;
}

.cx-layer {
  width: 100vw;
  height: 100vh;
  overflow: visible;
}

.cx-layer[hidden],
.cx-needle[hidden],
.cx-dot[hidden] {
  display: none;
}

.cx-yarn,
.cx-seam {
  fill: none;
  stroke: #bc4365;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cx-yarn-shadow,
.cx-seam-shadow {
  fill: none;
  stroke: rgb(42 35 38 / 16%);
  stroke-width: 2.2;
  stroke-linecap: round;
}

.cx-seam,
.cx-seam-shadow {
  stroke-dasharray: 8 6;
}

.cx-yarn-end {
  fill: #bc4365;
}

.cx-needle {
  width: 1px;
  height: 1px;
  overflow: visible;
  filter: drop-shadow(0 2px 2px rgb(42 35 38 / 22%));
  z-index: 2147483647;
}

.cx-steel {
  fill: url(#cx-acier);
  fill-rule: evenodd;
  stroke: #2a2326;
  stroke-width: 0.9;
  stroke-linejoin: round;
}

.cx-shine {
  fill: none;
  stroke: #fff;
  stroke-width: 0.7;
  stroke-linecap: round;
  opacity: 0.8;
}

/* vraie position de la souris pendant que l'aiguille coud ailleurs */
.cx-dot {
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: #702f48;
  box-shadow: 0 0 0 2px #fff;
  z-index: 2147483647;
}

/* clic : le petit trou que laisse l'aiguille dans la toile */
.cx-pique {
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border: 1.5px solid #702f48;
  border-radius: 50%;
  animation: cx-pique 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.cx-pique::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 3px;
  height: 3px;
  margin: -1.5px 0 0 -1.5px;
  border-radius: 50%;
  background: #702f48;
}

@keyframes cx-pique {
  from { transform: scale(0.3); opacity: 0.9; }
  to { transform: scale(1.6); opacity: 0; }
}

/* ---------- Boutons : le reflet satiné laisse la place aux effets brodés ---------- */
html.cx .button::after {
  content: none;
}

/* Point de croix : le fond se brode à partir de l'endroit où entre la souris */
.cx-cross {
  isolation: isolate;
}

.cx-cells {
  position: absolute;
  left: 0;
  display: grid;
  grid-auto-rows: 10px;
  z-index: -1;
  pointer-events: none;
}

.cx-st {
  position: relative;
  width: 10px;
  height: 10px;
  opacity: 0;
  transform: scale(0) rotate(-20deg);
  transition: transform 0.34s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.18s ease;
}

.cx-st.on {
  opacity: 1;
  transform: none;
}

.cx-st::before,
.cx-st::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10.5px;
  height: 2.3px;
  border-radius: 2px;
  background: currentColor;
  transform: translate(-50%, -50%) rotate(45deg);
}

.cx-st::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.cx-cross-dark .cx-cells { color: #bc4365; }
.cx-cross-dark .cx-st.alt { color: #a03658; }
.cx-cross-light .cx-cells { color: #e8879b; }
.cx-cross-light .cx-st.alt { color: #f2b3c0; }
.cx-cross-light .cx-st.on { opacity: 0.5; }
.cx-cross-gold .cx-cells { color: #d9a334; }
.cx-cross-gold .cx-st.alt { color: #c98f1f; }
.cx-cross-gold .cx-st.on { opacity: 0.75; }

/* Bouton à quatre trous : « Installer l'application » */
.cx-holes-icon {
  display: block;
  flex: none;
  width: 22px;
  height: 22px;
  margin-left: -4px;
  overflow: visible;
}

.cx-holes-icon .disc { fill: #fff; }
.cx-holes-icon .rim { fill: none; stroke: #702f48; stroke-width: 1; opacity: 0.35; }
.cx-holes-icon .hole { fill: #702f48; }
.cx-holes-icon .x1,
.cx-holes-icon .x2 {
  fill: none;
  stroke: #bc4365;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
}

html.cx .cx-holes-icon {
  transform: rotate(-40deg);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

html.cx .cx-holes-icon .x1,
html.cx .cx-holes-icon .x2 {
  transition: stroke-dashoffset 0.2s ease-out;
}

html.cx .cx-holes:is(:hover, :focus-visible) .cx-holes-icon { transform: scale(1.06); }
html.cx .cx-holes:is(:hover, :focus-visible) .cx-holes-icon .x1 { stroke-dashoffset: 0; transition-delay: 0.12s; }
html.cx .cx-holes:is(:hover, :focus-visible) .cx-holes-icon .x2 { stroke-dashoffset: 0; transition-delay: 0.34s; }
html.cx .cx-holes:active .cx-holes-icon { transform: scale(0.8); }

/* Le tambour se serre : « Se connecter » */
html.cx .sx-nav .sx-login {
  position: relative;
  isolation: isolate;
  box-shadow: 0 0 0 16px rgb(200 166 119 / 0%), 0 0 0 18px rgb(156 119 71 / 0%);
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

html.cx .sx-nav .sx-login::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background-image: radial-gradient(circle, rgb(112 47 72 / 24%) 1px, transparent 1.5px);
  background-size: 7px 7px;
  background-position: center;
  opacity: 0;
  transition: opacity 0.35s ease;
}

html.cx .sx-nav .sx-login:is(:hover, :focus-visible) {
  box-shadow: 0 0 0 4px #c8a677, 0 0 0 5.5px #9c7747;
  animation: cx-taut 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

html.cx .sx-nav .sx-login:is(:hover, :focus-visible)::before {
  opacity: 1;
}

html.cx .sx-nav .sx-login:focus-visible {
  outline-offset: 9px;
}

@keyframes cx-taut {
  0% { transform: scale(1); }
  35% { transform: scale(0.965); }
  70% { transform: scale(1.012); }
  100% { transform: scale(1); }
}

/* Le fil qui souligne : un point avant sous les liens « → ».
   Avec l'aiguille, c'est elle qui le coud au survol (couture.js). */
html.cx .text-link:is(:hover, :focus-visible) {
  text-decoration: underline dashed #bc4365;
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}

html.cx-aiguille .text-link:hover:not(:focus-visible) {
  text-decoration: none;
}

@media print {
  .cx-layer,
  .cx-needle,
  .cx-dot,
  .cx-pique,
  .cx-cells {
    display: none !important;
  }
}
