/* ═══════════════════════════ Mon objectif de l'année : la poupée Daruma et son œil blanc ═══════════════════════════
 *
 * Une poupée Daruma sur un anneau ouvert, l'occasion qu'on fête, l'objectif du client, une date de départ et **un œil laissé
 * blanc** à remplir au feutre. Servie **seulement** sur sa fiche (`views/product-affiche.liquid`). Le pourquoi des choix est dans
 * `lib/daruma-affiche.js`.
 *
 * ── Quatre styles, une seule mise en page ──
 *
 * Le style est un attribut (`[data-style]`) : la poupée, l'anneau et le texte ne bougent pas, seules les couleurs changent.
 * La poupée est rouge dans l'image : les fonds sont choisis pour elle.
 * - **Papier** : le washi crème, l'encre chaude, l'anneau rouge — celui qui ouvre.
 * - **Nuit** : le bleu nuit, l'anneau et les lignes d'or, le texte crème — celui qu'on offre.
 * - **Sauge** : un vert pâle de thé, l'encre vert profond.
 * - **Poudre** : le rose pâle, l'encre prune.
 *
 * Polices : Cormorant Garamond (l'objectif, la phrase, les dates) et Josefin Sans (les lignes en capitales espacées), déjà servies
 * par nous (point 2). **Aucun kanji n'est du texte** : ce sont des tracés (ceux du maneki), donc aucune police CJK à charger.
 *
 * ── Les palettes ──
 *
 * **Ce sont des couleurs de produit, pas de charte** (point 6 quater) : en clair, toutes ici, en tête, et nulle part ailleurs.
 * `[data-style]` ne nomme pas `.dk` exprès, pour que les échantillons du formulaire se colorent avec les mêmes variables.
 * --dk-fond / --dk-texte : le papier et l'encre ; --dk-accent : les lignes en capitales ; --dk-doux : les mentions et les traits à
 * écrire ; --dk-filet : le cadre ; --dk-anneau : l'anneau ouvert ; --dk-signe : le signe du ventre (or, sur le rouge de l'écusson) ;
 * --dk-oeil : l'œil déjà peint.
 * **Contrastes mesurés** (`tests/daruma.test.js`) : texte ≥ 7, accent et mention ≥ 4,5 sur le papier.
 */
[data-style="Papier"] {
  --dk-fond: #f6efe0; --dk-texte: #2a1d17; --dk-accent: #9b2f1c; --dk-doux: #6a574b; --dk-filet: #b64a33;
  --dk-anneau: #c9452d; --dk-signe: #f8dc92; --dk-oeil: #17100d;
}
[data-style="Nuit"] {
  --dk-fond: #17213a; --dk-texte: #f3e9d2; --dk-accent: #d9b45a; --dk-doux: #b9b3a6; --dk-filet: #a88b45;
  --dk-anneau: #d2aa4c; --dk-signe: #f8dc92; --dk-oeil: #17100d;
}
[data-style="Sauge"] {
  --dk-fond: #e3e8d3; --dk-texte: #1f2a1c; --dk-accent: #3f5e37; --dk-doux: #5a6a52; --dk-filet: #6f8f5e;
  --dk-anneau: #4f7a45; --dk-signe: #f8dc92; --dk-oeil: #17100d;
}
[data-style="Poudre"] {
  --dk-fond: #f7e3df; --dk-texte: #3b1f2b; --dk-accent: #8a3350; --dk-doux: #7a5560; --dk-filet: #c4788a;
  --dk-anneau: #b4506a; --dk-signe: #f8dc92; --dk-oeil: #17100d;
}

/* ── L'affiche ──
 *
 * Tout est en `cqw` : l'affiche se lit sur sa propre largeur. Les rapports vendus vont de 1,333 (30 × 40) à 1,5 (40 × 60) ;
 * la poupée garde sa taille et c'est l'air autour d'elle qui absorbe l'écart (`justify-content: center`), jamais une taille de
 * texte qui changerait avec le format. */
.dk {
  --fond: var(--dk-fond); --texte: var(--dk-texte);
  --dk-echelle: 1; --dk-fig: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 8cqw 9cqw 7cqw; box-sizing: border-box; text-align: center; line-height: 1;
  font-family: "Cormorant Garamond", Georgia, serif;
}
.dk :where(p) { margin: 0; padding: 0; }
.dk [hidden] { display: none !important; }

/* Le cadre : un filet épais et un filet fin, en retrait l'un de l'autre. */
.dk__cadre { position: absolute; inset: 3.6cqw; border: .3cqw solid var(--dk-filet); pointer-events: none; }
.dk__cadre::after { content: ""; position: absolute; inset: 1cqw; border: .12cqw solid var(--dk-filet); }

/* Les lignes en capitales espacées : Josefin Sans. L'espacement des lettres laisse un blanc après la dernière : on le
   compense à gauche pour que la ligne soit centrée sur l'encre. */
.dk__occasion, .dk__voeu, .dk__etiquette, .dk__yeux-dates b, .dk__proverbe i {
  font-family: "Josefin Sans", system-ui, sans-serif; text-transform: uppercase; font-weight: 600;
}
.dk__occasion {
  font-size: 2.3cqw; letter-spacing: .3em; padding-left: .3em; color: var(--dk-accent);
  margin-bottom: 1.6cqw; line-height: 1.35; text-wrap: balance; max-width: 80cqw;
}

/* La figure : un anneau ouvert (l'ensō du zen : le but n'est pas encore atteint) et la poupée dedans. */
.dk__fig { position: relative; width: calc(55cqw * var(--dk-fig)); aspect-ratio: 1; flex: none; display: grid; place-items: center; }
.dk__enso { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.dk__enso path { fill: none; stroke: var(--dk-anneau); stroke-width: 1.15; stroke-linecap: round; opacity: .85; }
.dk__poupee { position: relative; width: 76%; display: block; }
.dk__poupee img { display: block; width: 100%; height: auto; }
.dk__yeux { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
/* L'œil à remplir : un disque blanc, net, à peine plus petit que l'œil de l'image (son liseré d'or reste visible autour).
   L'œil déjà peint : un disque noir qui remplit presque l'œil. Les deux sont des cercles de la page, pas de l'image. */
.dk__oeil-vide, .dk__oeil-peint { transform-box: fill-box; transform-origin: center; }
.dk__oeil-vide { fill: #fff; transform: scale(.97); }
.dk__oeil-peint { fill: var(--dk-oeil); transform: scale(.9); }
.dk__signe { fill: var(--dk-signe); }

.dk__voeu {
  display: flex; align-items: center; justify-content: center; gap: 2.2cqw; margin-top: 1.8cqw;
  font-size: 2.3cqw; letter-spacing: .3em; color: var(--dk-accent);
}
.dk__voeu span { padding-left: .3em; }
.dk__voeu i { width: .9cqw; height: .9cqw; background: currentColor; transform: rotate(45deg); flex: none; }

.dk__etiquette { margin-top: 3.6cqw; font-size: 2.2cqw; letter-spacing: .28em; padding-left: .28em; color: var(--dk-doux); line-height: 1.3; max-width: 80cqw; }
.dk__objectif {
  margin-top: 1.4cqw; width: 100%; max-width: 82cqw; font-style: italic; font-weight: 500; letter-spacing: .005em;
  font-size: calc(8.2cqw * var(--dk-echelle)); line-height: 1.06; text-wrap: balance; color: var(--dk-texte); overflow-wrap: anywhere;
}

/* Les deux yeux : l'un est peint (la date où le but est posé), l'autre le sera. Une ligne à écrire sous chacun. */
.dk__yeux-dates { display: flex; gap: 6cqw; justify-content: center; margin-top: 4.4cqw; width: 100%; }
.dk__yeux-dates p { width: 36cqw; display: flex; flex-direction: column; align-items: center; gap: .8cqw; }
.dk__yeux-dates b { font-size: 1.9cqw; letter-spacing: .26em; padding-left: .26em; color: var(--dk-accent); }
.dk__trait {
  display: block; width: 100%; min-height: 4cqw; border-bottom: .2cqw solid var(--dk-doux); box-sizing: border-box;
  font-size: 3.2cqw; font-style: italic; font-weight: 500; line-height: 1.2; color: var(--dk-texte); white-space: nowrap;
}

.dk__phrase {
  margin-top: 3.4cqw; max-width: 72cqw; font-style: italic; font-weight: 500; font-size: 3.8cqw; line-height: 1.2;
  text-wrap: balance; color: var(--dk-texte);
}
.dk__proverbe { margin-top: 3.6cqw; display: flex; flex-direction: column; align-items: center; gap: .6cqw; color: var(--dk-doux); }
.dk__proverbe span { font-size: 2.8cqw; font-style: italic; font-weight: 500; line-height: 1.2; }
.dk__proverbe i { font-size: 1.5cqw; letter-spacing: .3em; padding-left: .3em; font-weight: 400; font-style: normal; }
.affiche__affiche.dk .affiche-exemple { opacity: .55; }

/* ── Le formulaire ── */
.dk-occasions, .dk-styles { display: grid; gap: .8rem; }
.dk-occasions, .dk-styles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dk-occasions input, .dk-styles input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dk-occasions label, .dk-styles label {
  display: flex; cursor: pointer; margin: 0; box-sizing: border-box; min-height: 4.8rem;
  border: .15rem solid rgba(var(--color-foreground), .15); border-radius: .8rem; line-height: 1.2;
}
.dk-occasions label { align-items: center; gap: 1rem; padding: .6rem 1rem; font-size: 1.4rem; font-weight: 600; text-align: left; }
.dk-oc-kanji {
  flex: none; width: 3.4rem; height: 3.4rem; display: inline-grid; place-items: center; border-radius: 50%;
  background: rgb(var(--ocre-fonce)); color: #fff; font-size: 1.8rem; font-weight: 700; line-height: 1;
}
.dk-styles label { flex-direction: column; align-items: flex-start; gap: .4rem; padding: .8rem 1rem 1rem; font-size: 1.4rem; font-weight: 600; }
.dk-styles small { font-size: 1.2rem; font-weight: 400; color: rgba(var(--color-foreground), .7); }
/* L'échantillon : le papier du style et son anneau, en miniature. */
.dk-echantillon { width: 100%; height: 3.6rem; display: grid; place-items: center; border-radius: .4rem; background: var(--dk-fond); border: .1rem solid rgba(0, 0, 0, .12); }
.dk-echantillon i { width: 2.4rem; height: 2.4rem; border-radius: 50%; border: .3rem solid var(--dk-anneau); border-right-color: transparent; box-sizing: border-box; }
.dk-occasions input:checked + label, .dk-styles input:checked + label { border-color: rgb(var(--color-foreground)); }
.dk-occasions input:focus-visible + label, .dk-styles input:focus-visible + label { outline: .2rem solid rgb(var(--bleu-focus)); outline-offset: .2rem; }
.dk-idees { display: flex; gap: .6rem; margin-top: .6rem; align-items: flex-start; }
.dk-idees[hidden] { display: none; }
.dk-idees-liste { display: flex; flex-wrap: wrap; gap: .6rem; flex: 1; min-width: 0; }
.dk-idees-liste button {
  min-height: 4.4rem; padding: .4rem 1.2rem; border: .1rem solid currentColor; border-radius: 99rem; background: transparent;
  font: inherit; font-size: 1.3rem; cursor: pointer; text-align: left; max-width: 100%;
}
