/* Les vitrines du guide /fr/packs-meme/ : le sélecteur de packs du jeu (client/pack-pick.ts) et son scanner X-ray
   (client/xray.ts), posés dans un article.

   Les deux écrans viennent avec leurs classes ; public/styles.css, que la page charge déjà, en habille la plus
   grande part (.booster, .tile, .pack-stage, .pack-closed, .what, .btn, .card). Ce fichier ne porte que ce qui
   n'existe que dans public/app/app.css (590 ko : hors de question sur une page publique) — la mise en page des
   .pk-*, .ed-* et de l'interrupteur de packs, et les montants (.amt, .coin-mark) — plus ce qu'il faut défaire d'un
   écran plein cadre : une barre d'actions collée au bas de l'écran et un scanner en position fixe n'ont pas de sens
   au milieu d'un texte.

   Règle du fichier : tout est porté par les deux hôtes [data-packs-live] et [data-xray-live], jamais par la page. */

[data-packs-live],
[data-xray-live] {
  /* Les variables de bouton que public/styles.css ne définit pas (app.css les pose sur :root). */
  --trait-btn: #6d7686;
  --inerte-fond: #5b6373;
  --inerte-encre: #ffffff;
  /* Aucune barre d'onglets sous un article : la barre d'actions ne se colle à rien. */
  --tabbar-h: 0px;
  margin: 18px 0 26px;
}

:root[data-theme="light"] [data-packs-live],
:root[data-theme="light"] [data-xray-live] {
  --trait-btn: #7a828f;
  --inerte-fond: #6b7280;
}

/* Rien ne dépasse à 320 px : les deux vitrines restent dans la colonne de l'article. */
[data-packs-live],
[data-xray-live] {
  max-width: 100%;
  overflow-x: clip;
}

/* ---- Le sélecteur de packs ---- */

[data-packs-live] .panel.center {
  display: grid;
  justify-items: center;
  gap: 14px;
  text-align: center;
}

[data-packs-live] .pk-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 10px;
  text-align: left;
}

[data-packs-live] .pk-body {
  position: relative;
  padding: 14px 0 4px;
}

[data-packs-live] .edition-stage .pk-body { padding-top: 10px; }

[data-packs-live] .edition-stage.has-jackpot .pk-body {
  display: grid;
  grid-template-columns: auto minmax(0, max-content);
  justify-content: center;
  align-items: center;
  gap: 14px;
}

/* Dans le jeu, .pk-actions est collée au-dessus de la barre d'onglets. Ici, elle suit le texte. */
[data-packs-live] .pk-actions {
  position: static;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 12px 0 4px;
  background: none;
}

[data-packs-live] .edition-stage .pk-actions { grid-template-columns: minmax(0, 1fr); }

[data-packs-live] .pk-actions .xray-btn,
[data-packs-live] .pk-actions .open-pack {
  box-sizing: border-box;
  height: 56px;
  margin: 0;
}

[data-packs-live] .pk-actions .open-pack {
  display: block;
  padding: 0 14px;
  line-height: 56px;
  font-size: clamp(16px, 4.8vw, 20px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* À 320 px, « Précommander 2 000 1 500 » est plus large que la colonne : le bouton rend ses marges, comme celui du
   jeu (public/app/app.css, sous 360 px), et celui d'une édition descend d'un point (Safari dessine ce texte un peu
   plus large que Chrome) pour garder son prix entier. */
@media (max-width: 359px) {
  [data-packs-live] .pk-actions .open-pack { padding-inline: 8px; }
  [data-packs-live] .edition-stage .pk-actions .open-pack { font-size: 15px; }
}

[data-packs-live] .btn.ed-btn {
  background: linear-gradient(135deg, #7c3aed, #6d28d9 55%, #4c1d95);
  color: #fff;
}

[data-packs-live] .pk-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0 8px;
  margin: 2px 0 0;
}

[data-packs-live] .pk-links .link-btn,
[data-packs-live] .pk-links .ed-all {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin: 0;
  padding: 0 6px;
  font-size: 14px;
}

/* La réserve de packs et la recharge appartiennent à un joueur : un article n'en a pas. */
[data-packs-live] .pk-now,
[data-packs-live] .pack-wait,
[data-packs-live] .pk-charges,
[data-packs-live] .pk-bonus-slot { display: none; }

[data-packs-live] .icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 6px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 16px;
}

[data-packs-live] .icon-btn svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentcolor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[data-packs-live] .link-btn {
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Les gestes du jeu sont devenus des liens : ils gardent l'allure d'un bouton. */
[data-packs-live] a.btn,
[data-packs-live] a.booster,
[data-packs-live] a.icon-btn,
[data-xray-live] a.btn { text-decoration: none; }

/* L'interrupteur de packs, dans la variante que l'écran /app/packs lui donne. */
[data-packs-live] .packs .pack-switch {
  --xn: #b9a4ff;
  position: relative;
  display: flex;
  flex: 1 1 100%;
  gap: 2px;
  box-sizing: border-box;
  width: auto;
  max-width: 100%;
  margin: 0;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
}

:root[data-theme="light"] [data-packs-live] .packs .pack-switch { --xn: #6d28d9; }

[data-packs-live] .pack-switch button {
  position: relative;
  display: inline-flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 56px;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: color .2s, background-color .2s;
  -webkit-tap-highlight-color: transparent;
}

[data-packs-live] .pack-switch button[aria-checked="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .25), inset 0 0 0 2px var(--trait-btn);
}

[data-packs-live] .pack-switch .sw-ico { font-size: 20px; line-height: 1; }

[data-packs-live] .pack-switch button[aria-checked="false"] .sw-ico {
  filter: grayscale(.6);
  opacity: .75;
}

[data-packs-live] .pack-switch .sw-name {
  font-size: 15px;
  font-weight: 900;
  font-style: italic;
  color: var(--heading);
}

[data-packs-live] .pack-switch button[aria-checked="false"] .sw-name { display: none; }

[data-packs-live] .pack-switch .sw-timer {
  color: var(--xn);
  font-size: 12px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

[data-packs-live] .pack-switch .ed-pick { font-size: 14px; }

/* Sous 360 px, l'onglet d'une édition annoncée sans date (« 🚫 Prochainement ») élargissait l'interrupteur au-delà
   de la colonne, et la tuile avec lui : ses bords étaient coupés. Les onglets resserrent leurs marges (48 px de
   large au moins : la cible du doigt reste au-dessus de 44 px). */
@media (max-width: 359px) {
  [data-packs-live] .pack-switch button {
    gap: 4px;
    min-width: 48px;
    padding: 0 8px;
  }
}

/* ---- L'édition limitée ---- */

[data-packs-live] .ed-badge {
  flex: none;
  padding: 6px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, #8b5cf6 22%, transparent);
  color: #6d28d9;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

/* Sous 360 px, « -25 % Prévente · sortie le 18 octobre à 00:00 » est plus large que la colonne : la pastille passe
   sur deux lignes au lieu d'être coupée par le bord de la vitrine. */
@media (max-width: 359px) {
  [data-packs-live] .ed-badge {
    flex: 0 1 auto;
    max-width: 100%;
    box-sizing: border-box;
    text-align: center;
    text-wrap: balance;
  }
}

:root[data-theme="dark"] [data-packs-live] .ed-badge { color: #ddd0ff; }

/* La pastille rouge est un seul bloc : « -25 % en précommande » ne se coupe jamais après le « - », et la ligne peut
   passer à la suivante juste avant elle (« Prochainement » la touche sans espace). */
[data-packs-live] .ed-badge .ed-off {
  display: inline-block;
  white-space: nowrap;
  margin-right: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
}

/* « Prochainement » puis la remise de la prévente : la pastille rouge vient après le mot. */
[data-packs-live] .ed-badge .ed-off.ed-after { margin: 0 0 0 6px; }

[data-packs-live] .ed-fomo {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: color-mix(in srgb, #8b5cf6 12%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #8b5cf6 30%, transparent);
  color: #6d28d9;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
  text-wrap: balance;
}

:root[data-theme="dark"] [data-packs-live] .ed-fomo { color: #ddd0ff; }

/* « Édition permanente : elle reste en vente après la sortie », en tête de la note de prévente : sa propre pastille,
   au-dessus du prix, comme dans le jeu. */
[data-packs-live] .ed-fomo .ed-week {
  display: table;
  margin: -2px auto 10px;
  padding: 7px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  box-shadow: 0 4px 12px -4px rgb(185 28 28 / .55);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .01em;
  text-align: center;
  text-wrap: balance;
}

/* ---- Un montant frappé (la note et le bouton d'une édition), sans app/app.css ----
   coinsText écrit le jeton du jeu, une image de 64 px que seule app/app.css ramène à la taille du texte : sans ces
   règles, il s'affiche en grand dans la note et coupe le bouton. */

[data-packs-live] .amt {
  display: inline-flex;
  align-items: center;
  gap: .18em;
  white-space: nowrap;
  vertical-align: baseline;
}

/* L'or d'un montant, le jeton du jeu (public/app/app.css, --amt-fill) : un arrêt plus bas sur le thème clair. */
[data-packs-live] {
  --amt-fill: linear-gradient(180deg, var(--gold-text-light), var(--gold-text) 55%, var(--gold-text-deep));
}

:root[data-theme="light"] [data-packs-live] {
  --amt-fill: linear-gradient(180deg, var(--gold-text-light), var(--gold-text) 60%, var(--gold-text-deep));
}

[data-packs-live] .amt-n {
  background: var(--amt-fill);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

/* Le dernier montant de la note et son point ne font qu'un : sans quoi Chrome et Safari laissent le point partir
   seul en tête de la ligne suivante (« . Tes packs précommandés… »), le jeton étant une image. */
[data-packs-live] .ed-fomo .ed-nb { white-space: nowrap; }

/* Dans un bouton, les chiffres prennent son encre : l'or y disparaîtrait. */
[data-packs-live] .btn .amt-n {
  background: none;
  color: inherit;
}

[data-packs-live] .coin-mark {
  display: inline-block;
  flex: none;
  width: 1em;
  height: 1em;
  font-style: normal;
  vertical-align: middle;
}

/* L'ancien prix barré de la précommande : plus petit que le nouveau et barré, dans l'encre pleine du bouton. Le jeu
   l'éclaircit d'une opacité, que la charte interdit sur du texte (docs/design/charte.md). */
[data-packs-live] .ed-was {
  font-size: .72em;
  font-weight: 800;
  text-decoration-thickness: 2px;
}

[data-packs-live] .ed-all {
  font-size: 14px;
  font-weight: 800;
  color: var(--muted);
  text-decoration: none;
}

[data-packs-live] .ed-jackpot {
  display: grid;
  justify-items: center;
  gap: 6px;
  width: clamp(104px, 30vw, 136px);
  text-align: center;
}

[data-packs-live] .ej-tag {
  padding: 4px 10px;
  border-radius: 999px;
  background: #1c1405;
  color: #ffd76a;
  box-shadow: inset 0 0 0 1px rgba(255, 215, 106, .55);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}

[data-packs-live] .ej-card {
  width: 100%;
  filter: drop-shadow(0 0 14px rgba(255, 196, 64, .45));
}

[data-packs-live] .ej-prize {
  display: grid;
  justify-items: center;
  gap: 1px;
  margin: 2px 0 0;
  line-height: 1.2;
}

[data-packs-live] .ej-prize .ej-ico { font-size: 18px; line-height: 1; }

[data-packs-live] .ej-prize b {
  font-size: 14px;
  font-weight: 900;
  color: var(--gold-text);
}

[data-packs-live] .ej-prize span:last-child {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

/* ---- Le scanner X-ray ---- */

/* public/app/xray.css le pose en plein écran (position: fixed; inset: 0). Dans l'article, il devient un bloc :
   le reste de sa feuille — le faisceau, les emplacements, les raretés — joue tel quel. */
[data-xray-live] .xr {
  position: relative;
  inset: auto;
  z-index: 0;
  min-height: min(560px, 118vw);
  border-radius: 18px;
}

/* Le bouton « passer » du jeu est en haut de l'écran : ici, en haut du bloc. */
[data-xray-live] .xr-skip { top: 12px; }

[data-xray-live] .xr-scope {
  width: min(240px, 52vw);
  margin-top: 46px;
}

[data-xray-live] .xr-panel { padding-bottom: 16px; }

[data-xray-live] .xr-acts .btn { text-decoration: none; }

/* ---- Mouvement ---- */

/* Comme le jeu : qui demande moins d'animation voit la radiographie, pas le balayage. */
@media (prefers-reduced-motion: reduce) {
  [data-packs-live] *,
  [data-xray-live] * {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Le scanner ne s'anime qu'une fois à l'écran : sa place est réservée pour que l'article ne saute pas à son arrivée. */
[data-xray-live] { min-height: 590px; }
@media (min-width: 760px) { [data-xray-live] { min-height: 640px; } }
