/* =============================================================
   PAGE AVATARS & COSMETIQUES
   La rarete est l'information principale: elle doit se lire avant
   le texte. Chaque grade a donc son badge, son filet et le halo de
   ses pastilles, tous tires du meme token.
   ============================================================= */

.eyebrow {
  font-family: var(--dop-font-body);
  font-weight: 700;
  font-size: var(--dop-fs-sm);
  text-transform: uppercase;
  letter-spacing: var(--dop-tracking-eyebrow);
  color: var(--dop-ink-3);
  margin-bottom: 18px;
}

.grad { color: var(--dop-primary); }

.sec-head { max-width: 720px; margin: 0 0 48px; }

.sec-head h2 {
  font-size: clamp(30px, 3.6vw, 52px);
  font-weight: 800;
  letter-spacing: var(--dop-tracking-section);
  line-height: var(--dop-lh-snug);
}

.sec-head p { margin-top: 18px; color: var(--dop-ink-2); font-size: var(--dop-fs-lead); line-height: var(--dop-lh-normal); }

/* ---------- Hero: le meme avatar, avant et apres ---------- */
.av-hero { padding: clamp(48px, 6vw, 84px) 0; border-bottom: 1px solid var(--dop-rule); }

.av-hero-grid {
  display: grid;
  grid-template-columns: 1fr minmax(0, 480px);
  align-items: center;
  gap: clamp(36px, 5vw, 80px);
}

.av-hero h1 {
  font-size: var(--dop-fs-hero);
  font-weight: 800;
  line-height: var(--dop-lh-tight);
  letter-spacing: var(--dop-tracking-hero);
}

.av-hero .lead {
  margin-top: 22px;
  max-width: 46ch;
  color: var(--dop-ink-2);
  font-size: var(--dop-fs-lead);
  line-height: var(--dop-lh-normal);
}

.av-swap {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: clamp(12px, 2vw, 24px);
}

.av-swap figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; }

.av-swap img {
  width: 100%;
  height: auto;
  border-radius: var(--dop-radius-xl);
  border: 1px solid var(--dop-border-strong);
}

/* Le second porte le halo rose: c'est lui qui montre le resultat.
   La lueur passe derriere l'image pour deborder du cadre, le liseré
   et l'ombre portee restent sur l'image elle-meme. */
.av-swap figure:last-of-type { position: relative; isolation: isolate; }

.av-swap figure:last-of-type::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 46%;
  width: 118%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(221, 75, 149, .45), rgba(221, 75, 149, 0) 65%);
  filter: blur(26px);
  z-index: -1;
  pointer-events: none;
}

.av-swap figure:last-of-type img {
  border-color: rgba(221, 75, 149, .55);
  box-shadow:
    0 0 0 1px rgba(221, 75, 149, .45),
    0 0 28px rgba(221, 75, 149, .35),
    0 20px 48px rgba(221, 75, 149, .3);
}

.av-swap figcaption { color: var(--dop-ink-3); font-size: var(--dop-fs-xs); text-align: center; }
.av-arrow { color: var(--dop-primary); font-size: 26px; font-weight: 700; }

/* ---------- Les quatre grades ---------- */
.av-tiers .tier { padding: clamp(28px, 3.4vw, 44px) 0; border-top: 1px solid var(--dop-rule); }
.av-tiers .tier:first-of-type { border-top: 0; }

.tier[data-rarity="common"]    { --tier: var(--dop-common); }
.tier[data-rarity="rare"]      { --tier: var(--dop-rare); }
.tier[data-rarity="epic"]      { --tier: var(--dop-epic); }
.tier[data-rarity="legendary"] { --tier: var(--dop-legendary); }

.tier-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 28px; }

/* Le nom du grade porte sa couleur et sa pastille: la categorie se lit
   avant meme le texte qui la decrit. */
.tier-head h2 {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: clamp(24px, 2.6vw, 34px);
  font-weight: 800;
  letter-spacing: var(--dop-tracking-tight);
  color: var(--tier);
}

.tier-head h2::before {
  content: '';
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--tier);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--tier) 20%, transparent),
              0 0 20px color-mix(in srgb, var(--tier) 60%, transparent);
}

.tier-head p { color: var(--dop-ink-2); max-width: 56ch; line-height: var(--dop-lh-normal); }

.tier-marquee {
  overflow: hidden;
  -webkit-mask: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
          mask: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
}

.tier-items {
  display: flex;
  gap: clamp(18px, 2.4vw, 34px);
  width: max-content;
  list-style: none;
  padding: 6px 0;
  margin: 0;
  animation: tier-scroll 46s linear infinite;
}

.tier-marquee:hover .tier-items { animation-play-state: paused; }

@keyframes tier-scroll { to { transform: translateX(calc(-50% - 17px)); } }

/* Chaque grade a son rythme, et un sens alterne. */
.tier[data-rarity="rare"] .tier-items      { animation-duration: 54s; animation-direction: reverse; }
.tier[data-rarity="epic"] .tier-items      { animation-duration: 50s; }
.tier[data-rarity="legendary"] .tier-items { animation-duration: 58s; animation-direction: reverse; }

@media (prefers-reduced-motion: reduce) {
  .tier-items { animation: none; }
  .tier-marquee { overflow-x: auto; }
}

.tier-items > li { flex: 0 0 auto; width: 116px; }

.tier-items li {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.tier-items li::before {
  content: '';
  position: absolute;
  top: -8%;
  left: 50%;
  width: 92%;
  aspect-ratio: 1;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--tier) 38%, transparent), transparent 70%);
  filter: blur(14px);
}

.tier-items img {
  position: relative;
  width: 100%;
  max-width: 116px;
  height: auto;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--tier) 45%, transparent);
}

.tier-items span {
  position: relative;
  color: var(--dop-ink-2);
  font-size: var(--dop-fs-xs);
  line-height: 1.35;
}

/* ---------- La galerie: le resultat sur de vrais avatars ---------- */
.av-gallery-section { border-top: 1px solid var(--dop-rule); }

.avatar-card { margin: 0; }

.avatar-card img {
  width: 100%;
  height: auto;
  border-radius: var(--dop-radius-xl);
  border: 1px solid var(--dop-border-strong);
  box-shadow: var(--dop-shadow-card);
}

/* ---------- Clôture ---------- */
.av-cta { border-top: 1px solid var(--dop-rule); text-align: center; }
.av-cta h2 { font-size: clamp(28px, 3.4vw, 46px); font-weight: 800; letter-spacing: var(--dop-tracking-section); }
.av-cta p { margin: 16px auto 0; max-width: 46ch; color: var(--dop-ink-2); font-size: var(--dop-fs-lead); }
.av-cta .store-buttons { justify-content: center; }

@media (max-width: 920px) {
  .av-hero-grid { grid-template-columns: 1fr; }
  /* L'avant/apres reste cote a cote: deux vignettes, pas deux ecrans. */
  .av-swap { max-width: 460px; }
}

/* Meme geste sur les grilles de la page: la piece survolee ressort. */
.tier-items img,
.tier-items li::before,
.tier-items span {
  transition: transform var(--dop-dur) var(--dop-ease-out),
              border-color var(--dop-dur),
              color var(--dop-dur);
}

.tier-items li:hover img {
  transform: scale(1.12);
  border-color: color-mix(in srgb, var(--tier) 80%, transparent);
}

.tier-items li:hover::before { transform: translateX(-50%) scale(1.25); }
.tier-items li:hover span { color: var(--dop-ink-1); }

.avatar-card img { transition: transform var(--dop-dur) var(--dop-ease-out), border-color var(--dop-dur); }
.avatar-card:hover img { transform: translateY(-6px); border-color: rgba(221, 75, 149, .45); }

@media (prefers-reduced-motion: reduce) {
  .tier-items li:hover img,
  .tier-items li:hover::before,
  .avatar-card:hover img { transform: none; }
}

/* ---------- Carrousel des avatars ----------
   Meme mecanique que les autres pistes du site: le jeu est duplique et
   translate d'une demi-longueur, donc la boucle ne saute pas. */
.av-marquee {
  overflow: hidden;
  -webkit-mask: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
          mask: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}

.av-track {
  display: flex;
  align-items: flex-end;
  gap: clamp(14px, 1.8vw, 24px);
  width: max-content;
  padding: 8px 0;
  animation: av-scroll 64s linear infinite;
}

.av-marquee:hover .av-track { animation-play-state: paused; }

@keyframes av-scroll { to { transform: translateX(calc(-50% - 12px)); } }

@media (prefers-reduced-motion: reduce) {
  .av-track { animation: none; }
  .av-marquee { overflow-x: auto; }
}

.avatar-card { flex: 0 0 auto; margin: 0; }

/* Les cartes a decor gardent leur cadre; les avatars detoures se posent
   sur le sol de la page, avec un halo pour les asseoir. */
.avatar-card img {
  width: 200px;
  height: auto;
  border-radius: var(--dop-radius-xl);
  border: 1px solid var(--dop-border-strong);
  box-shadow: var(--dop-shadow-card);
  transition: transform var(--dop-dur) var(--dop-ease-out), border-color var(--dop-dur);
}

.avatar-card--cutout { position: relative; display: flex; align-items: flex-end; }

.avatar-card--cutout::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 6%;
  width: 130%;
  aspect-ratio: 1;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(221, 75, 149, .16), rgba(141, 103, 251, .08) 48%, transparent 70%);
  filter: blur(24px);
}

.avatar-card--cutout img {
  position: relative;
  width: auto;
  height: 300px;
  object-fit: contain;
  object-position: bottom;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  filter: drop-shadow(0 16px 26px rgba(0, 0, 0, .5));
}

.avatar-card:hover img { transform: translateY(-8px); border-color: rgba(221, 75, 149, .45); }

@media (prefers-reduced-motion: reduce) {
  .avatar-card:hover img { transform: none; }
}

@media (max-width: 620px) {
  .avatar-card img { width: 150px; }
  .avatar-card--cutout img { width: auto; height: 230px; }
}

/* =============================================================
   CONFIGURATEUR — /assets/js/avatar-studio.js
   Le moteur dessine l'avatar et les vignettes dans des canvas; la page ne
   fait que les poser. L'apercu garde la couleur de fond choisie: c'est
   exactement l'image qui sera exportee.
   ============================================================= */

.av-builder { border-bottom: 1px solid var(--dop-rule); }
.av-builder .sec-head { margin-bottom: clamp(32px, 4vw, 56px); }

.dpm-statut { color: var(--dop-ink-3); font-size: var(--dop-fs-sm); }
html:not(.js) .dpm-hote > .dpm-statut:first-child { display: none; }

.avs {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--dop-space-6, 24px);
  max-width: 1080px;
  margin-inline: auto;
}

/* Le personnage, dans le cadre des captures du site. */
.avs-stage {
  position: relative;
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: var(--avs-fond, #1f2333);
  overflow: hidden;
  transition: background-color var(--dop-dur, 200ms) var(--dop-ease-out, ease-out);
}
.avs-stage canvas { display: block; width: 100%; height: clamp(280px, 34vw, 400px); }
.avs-stage canvas[hidden] { display: none; }

/* Buste / corps: deux boutons poses sur l'image. */
.avs-view {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(15, 17, 23, .82);
}
.avs-view button {
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--dop-ink-2);
  font: 700 14px/1 var(--dop-font-body);
  cursor: pointer;
}
.avs-view button[aria-pressed="true"] { background: var(--dop-primary); color: #fff; }

/* Les onglets: une ligne de libelles soulignes, pas de pastilles. */
.avs-tabs {
  display: flex;
  gap: 4px 18px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--dop-rule);
}
.avs-tabs::-webkit-scrollbar { display: none; }
.avs-tabs button {
  flex: none;
  min-height: 44px;
  padding: 0 2px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--dop-ink-3);
  font: 700 15px/1 var(--dop-font-body);
  cursor: pointer;
}
.avs-tabs button:hover { color: var(--dop-ink-1); }
.avs-tabs button[aria-selected="true"] { color: var(--dop-ink-1); border-bottom-color: var(--dop-primary); }

.avs-groups {
  display: grid;
  gap: 22px;
  max-height: min(64vh, 620px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
}
.avs-group-title {
  margin: 0 0 10px;
  font-family: var(--dop-font-display);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: var(--dop-tracking-tight);
}
.avs-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
.avs-grid--swatch { grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); }
.avs .duo-tile:hover { border-color: rgba(221, 75, 149, .6) !important; }

.avs-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.avs-actions .avs-png { flex: 1 1 220px; }

/* Bureau: le personnage reste a gauche pendant qu'on parcourt les pieces. */
@media (min-width: 900px) {
  .avs {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    column-gap: clamp(28px, 4vw, 56px);
    align-items: start;
  }
  .avs-left { position: sticky; top: 96px; }
}
.avs-left,
.avs-right { display: grid; gap: var(--dop-space-6, 24px); min-width: 0; }

/* Telephone: l'apercu reste visible en haut pendant qu'on choisit. */
@media (max-width: 899px) {
  .avs-left { display: contents; }
  .avs-stage { position: sticky; top: 72px; z-index: 2; }
  .avs-actions { order: 3; }
  .avs-right { order: 2; }
  .avs-stage canvas { height: clamp(200px, 52vw, 300px); }
  .avs-groups { max-height: none; overflow: visible; }
}

@media (prefers-reduced-motion: reduce) {
  .avs-stage { transition: none; }
}


/* ---------- La fenetre d'email ----------
   Elle s'ouvre au premier telechargement: l'image part une fois l'adresse
   donnee. C'est un controle, pas un bloc de contenu: il garde donc un fond
   et un filet, comme les champs de formulaire du site. */
.dpm-voile {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: var(--dop-space-5);
  background: rgba(10, 11, 17, .72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.dpm-fenetre {
  width: min(420px, 100%);
  display: grid;
  gap: var(--dop-space-4);
  padding: clamp(24px, 4vw, 34px);
  border-radius: var(--dop-radius-xl);
  background: var(--dop-card);
  border: 1px solid var(--dop-border-strong);
  box-shadow: var(--dop-shadow-card), 0 0 60px -20px var(--dop-primary);
}

.dpm-fenetre-titre {
  font-size: clamp(22px, 2.4vw, 28px);
  line-height: var(--dop-lh-snug);
  letter-spacing: var(--dop-tracking-tight);
}

.dpm-fenetre-texte { color: var(--dop-ink-2); font-size: var(--dop-fs-body); line-height: var(--dop-lh-normal); }

.dpm-champ {
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border-radius: var(--dop-radius-md);
  border: 1px solid var(--dop-border-strong);
  background: rgba(255, 255, 255, .04);
  color: var(--dop-ink-1);
  font: inherit;
}

.dpm-champ::placeholder { color: var(--dop-ink-3); }
.dpm-champ:focus-visible { border-color: var(--dop-primary); outline: 2px solid var(--dop-primary); outline-offset: 2px; }

.dpm-fenetre-mention { color: var(--dop-ink-3); font-size: var(--dop-fs-xs); line-height: var(--dop-lh-normal); }
.dpm-fenetre-mention a { color: var(--dop-primary); font-weight: 700; }

.dpm-turnstile:empty { display: none; }

.dpm-fenetre-erreur { color: var(--dop-primary); font-size: var(--dop-fs-sm); font-weight: 700; }
.dpm-fenetre-erreur:empty { display: none; }

@media (prefers-reduced-motion: no-preference) {
  .dpm-voile { animation: dpm-voile 180ms var(--dop-ease-out); }
  .dpm-fenetre { animation: dpm-fenetre 220ms var(--dop-ease-out); }
}

@keyframes dpm-voile { from { opacity: 0; } }
@keyframes dpm-fenetre { from { opacity: 0; transform: translateY(12px); } }

/* Le halo du second visuel deborde de 18%: il ne doit pas elargir la page. */
.av-hero { overflow-x: clip; }

/* ---------- Defiles des grades sur ecran tactile ----------
   Meme regle que la home: une bande qu'on fait glisser, sans doublons. */
@media (hover: none) and (pointer: coarse) {
  .tier-marquee {
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-mask: none;
            mask: none;
  }
  .tier-marquee::-webkit-scrollbar { display: none; }
  .tier-items { animation: none; }
  .tier-items li[aria-hidden="true"] { display: none; }
  .tier-items li { scroll-snap-align: start; }
}


/* ---------- Illustrations des en-tetes ----------
   Une scene a cote du titre de section, a droite; elle passe sous le
   texte sur mobile. Le bas de l'en-tete garde sa marge habituelle. */
.av-head-split {
  display: grid;
  grid-template-columns: minmax(0, 720px) minmax(0, 300px);
  justify-content: space-between;
  align-items: end;
  gap: clamp(24px, 4vw, 64px);
  margin-bottom: 48px;
}
.av-head-split .sec-head { margin-bottom: 0; }
.av-head-split .av-head-illus { margin: 0; }
.av-head-illus img { margin-inline: auto; }
.av-cta-illus { margin: 0 auto 24px; }
.av-cta-illus img { display: block; margin-inline: auto; }
.av-cta-illus.pg-cutout img { max-height: 220px; }

@media (max-width: 920px) {
  .av-head-split { grid-template-columns: 1fr; margin-bottom: 36px; }
  .av-head-split .av-head-illus.pg-cutout img { max-height: 200px; }
  .av-cta-illus.pg-cutout img { max-height: 170px; }
}
