/* ============================================
   DUAL EMPIRES - Profil du joueur (Alpha 0.1.3, chantier C3, js/profil.js)
   ============================================
   Charte : obsidienne, or antique, saphir, ivoire (variables locales,
   provisoires, à raccorder au système central du chantier C5). */

:root {
  --profil-obsidienne: #0e1018;
  --profil-or: #c9a24b;
  --profil-or-clair: #e8c87a;
  --profil-saphir: #3b6fd8;
  --profil-ivoire: #f3ead6;
}

/* ----- Avatar : portrait sous le cadre officiel (deux images, jamais fusionnées) ----- */
.profil-avatar {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  flex: none;
}

/* Portrait réduit et découpé en ellipse dans l'ouverture du cadre (≈ 69 % × 63 % du cadre) */
.profil-avatar-portrait {
  position: absolute;
  inset: 10%;
  width: 80%;
  height: 80%;
  object-fit: cover;
  clip-path: ellipse(46% 42% at 50% 50%);
}

.profil-avatar-cadre {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ----- Bannière : bandeau 3:1, image à ses proportions (contain : ni étirée, ni recadrée) ----- */
.profil-banniere {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 1;
  background: var(--profil-obsidienne);
  border: 1px solid rgba(201, 162, 75, 0.55);
  border-radius: 8px;
  overflow: hidden;
}

.profil-banniere-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.profil-deckbox {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
}

/* ----- Deck box : apparence des decks listés (Mes Decks, choix du deck), décorative ----- */
.deck-avec-boite {
  position: relative;
  padding-right: 96px !important;
}

.deck-carte-boite {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 78px;
  pointer-events: none;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.55));
}

/* ----- Badge du menu principal ----- */
.profil-badge-zone {
  position: fixed;
  top: 14px;
  left: 16px;
  z-index: 5;
}

.profil-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 14px 4px 4px;
  border: 1px solid rgba(201, 162, 75, 0.6);
  border-radius: 999px;
  background: rgba(14, 16, 24, 0.78);
  color: var(--profil-ivoire);
  font-family: "Cinzel", Georgia, serif;
  font-size: 0.9rem;
  text-decoration: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

.profil-badge:hover,
.profil-badge:focus-visible {
  border-color: var(--profil-or-clair);
  box-shadow: 0 0 10px rgba(59, 111, 216, 0.55);
}

.profil-badge .profil-avatar {
  width: 54px;
}

.profil-badge-pseudo {
  max-width: 12em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ----- Page du profil ----- */
.profil-page {
  max-width: 980px;
  margin: 0 auto;
  color: var(--profil-ivoire);
}

.profil-entete {
  position: relative;
  margin-bottom: 64px;
}

.profil-entete .profil-avatar {
  position: absolute;
  left: 4%;
  bottom: -56px;
  width: clamp(96px, 16vw, 150px);
}

.profil-entete-pseudo {
  position: absolute;
  left: calc(4% + clamp(96px, 16vw, 150px) + 14px);
  bottom: -40px;
  margin: 0;
  color: var(--profil-or-clair);
  font-family: "Cinzel", Georgia, serif;
  font-size: clamp(1.1rem, 2.4vw, 1.6rem);
}

.profil-section {
  margin: 18px 0;
  padding: 14px 16px;
  background: rgba(14, 16, 24, 0.82);
  border: 1px solid rgba(201, 162, 75, 0.45);
  border-radius: 8px;
}

.profil-section h2 {
  margin: 0 0 10px;
  color: var(--profil-or-clair);
  font-size: 1.1rem;
}

.profil-note {
  margin: 6px 0 0;
  opacity: 0.85;
  font-size: 0.85rem;
  font-style: italic;
}

.profil-choix {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.profil-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border: 2px solid rgba(201, 162, 75, 0.35);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  color: var(--profil-ivoire);
  font: inherit;
  cursor: pointer;
}

.profil-option[aria-pressed="true"] {
  border-color: var(--profil-saphir);
  box-shadow: 0 0 10px rgba(59, 111, 216, 0.6);
}

.profil-option:hover,
.profil-option:focus-visible {
  border-color: var(--profil-or-clair);
}

.profil-option--avatar {
  width: 150px;
}

.profil-option--banniere {
  width: min(100%, 300px);
}

.profil-apercus {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: flex-start;
}

.profil-apercu {
  width: 150px;
  margin: 0;
  text-align: center;
  font-size: 0.85rem;
}

.profil-apercu img {
  display: block;
  width: 100%;
  height: auto;
}

.profil-confirmation {
  min-height: 1.3em;
  color: var(--profil-or-clair);
}

@media (max-width: 600px) {
  .profil-badge-pseudo {
    display: none;
  }

  .profil-badge {
    padding-right: 4px;
  }
}

/* ----- Page du profil : trois colonnes (directive V1.9 §4.2) ----- */
/* Gauche : rubriques ; centre : identité du joueur ; droite : personnalisation de la rubrique active. */
.profil-trois-colonnes {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr) minmax(320px, 400px);
  gap: 18px;
  align-items: start;
  max-width: 1480px;
}

.profil-trois-colonnes > .profil-section {
  margin: 0;
}

.visuellement-masque {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Rubriques */
.profil-nav {
  position: sticky;
  top: 12px;
}

.profil-nav-titre {
  margin: 0 0 8px;
  color: var(--profil-or-clair);
  font-family: "Cinzel", Georgia, serif;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.profil-rubriques {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profil-rubrique {
  padding: 9px 10px;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 0 6px 6px 0;
  background: transparent;
  color: var(--profil-ivoire);
  font-family: "Cinzel", Georgia, serif;
  font-size: 0.92rem;
  text-align: left;
  cursor: pointer;
}

.profil-rubrique:hover,
.profil-rubrique:focus-visible {
  border-left-color: var(--profil-or-clair);
  background: rgba(59, 111, 216, 0.16);
}

.profil-rubrique.actif {
  border-left-color: var(--profil-saphir);
  background: linear-gradient(90deg, rgba(59, 111, 216, 0.32), rgba(59, 111, 216, 0.06));
  color: var(--profil-or-clair);
}

/* Identité (centre) : bannière, avatar qui chevauche son bas, pseudo et compte à côté de l'avatar. */
.profil-identite-carte .profil-entete {
  display: grid;
  grid-template-columns: clamp(110px, 11vw, 160px) minmax(0, 1fr);
  column-gap: 16px;
  margin-bottom: 12px;
}

.profil-identite-carte #profil-banniere-apercu {
  grid-column: 1 / -1;
}

.profil-identite-carte #profil-avatar-apercu {
  grid-row: 2 / span 2;
  position: relative;
  z-index: 1;
  margin: calc(-0.42 * clamp(110px, 11vw, 160px)) 0 0 clamp(8px, 2%, 24px);
}

.profil-identite-carte .profil-entete .profil-avatar {
  position: relative;
  left: auto;
  bottom: auto;
  width: 100%;
}

.profil-identite-carte .profil-entete-pseudo {
  position: static;
  align-self: end;
  margin: 10px 0 0;
  color: var(--profil-or-clair);
  font-family: "Cinzel", Georgia, serif;
  font-size: clamp(1.25rem, 2.2vw, 1.8rem);
  overflow-wrap: anywhere;
}

.profil-compte {
  margin: 2px 0 0;
  font-size: 0.85rem;
  opacity: 0.85;
}

.profil-apercu-etat {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  margin: 0 0 12px;
  padding: 8px 12px;
  border: 1px solid var(--profil-saphir);
  border-radius: 8px;
  background: rgba(59, 111, 216, 0.14);
}

.profil-apercu-etat[hidden] {
  display: none;
}

.profil-apercu-etat p {
  margin: 0;
}

.profil-apercu-actions {
  display: flex;
  gap: 8px;
}

.btn-profil {
  padding: 7px 16px;
  border: 1px solid rgba(201, 162, 75, 0.7);
  border-radius: 6px;
  background: rgba(14, 16, 24, 0.9);
  color: var(--profil-ivoire);
  font-family: "Cinzel", Georgia, serif;
  font-size: 0.9rem;
  cursor: pointer;
}

.btn-profil--principal {
  border-color: var(--profil-or-clair);
  background: linear-gradient(180deg, rgba(201, 162, 75, 0.45), rgba(120, 90, 30, 0.45));
}

.btn-profil:hover,
.btn-profil:focus-visible {
  box-shadow: 0 0 10px rgba(59, 111, 216, 0.6);
}

.profil-blocs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.profil-bloc {
  padding: 10px 12px;
  border: 1px solid rgba(201, 162, 75, 0.3);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.28);
}

.profil-bloc h3 {
  margin: 0 0 8px;
  color: var(--profil-or-clair);
  font-family: "Cinzel", Georgia, serif;
  font-size: 0.95rem;
}

.profil-liste {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 12px;
  margin: 0;
  font-size: 0.9rem;
}

.profil-liste dt {
  opacity: 0.8;
}

.profil-liste dd {
  margin: 0;
  text-align: right;
}

/* Personnalisation (droite) */
.profil-personnalisation {
  position: sticky;
  top: 12px;
}

.profil-panneau h2 {
  margin: 0 0 10px;
  color: var(--profil-or-clair);
  font-size: 1.1rem;
}

.profil-personnalisation .profil-option--avatar {
  width: calc(50% - 7px);
}

.profil-choix--bannieres {
  flex-direction: column;
}

.profil-personnalisation .profil-option--banniere {
  width: 100%;
}

.profil-option[data-apercu="true"] {
  border-color: var(--profil-or-clair);
  border-style: dashed;
}

.profil-option-etat {
  min-height: 1.2em;
  color: var(--profil-or-clair);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.profil-apercu--cadre {
  width: 170px;
}

.profil-cadre-seul {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  background: repeating-conic-gradient(rgba(255, 255, 255, 0.08) 0% 25%, transparent 0% 50%) 0 0 / 16px 16px;
  border-radius: 8px;
}

.profil-trois-colonnes > .profil-confirmation {
  grid-column: 1 / -1;
  margin: 0;
}

/* Finalisation du peaufinage : page stable. css/style.css centre le contenu dans la fenêtre : la page entière se
   déplaçait donc dès qu'une rubrique changeait de hauteur (Identité, puis Avatar et ses douze portraits), et son haut
   sortait de l'écran sur une fenêtre basse. La page part maintenant du haut et tient dans la fenêtre ; une rubrique plus
   haute que la place disponible défile dans son propre panneau (molette au survol), sans rien déplacer autour. */
body[data-fond="profil"] {
  align-items: flex-start;
}

@media (min-width: 1101px) {
  body[data-fond="profil"] .page-container {
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    height: 100vh;
    padding: 2.4vh 0 2vh;
  }

  body[data-fond="profil"] .profil-trois-colonnes {
    flex: 1 1 auto;
    min-height: 0;
    grid-template-rows: minmax(0, 1fr) auto;
  }

  body[data-fond="profil"] .profil-trois-colonnes > .profil-section {
    max-height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

/* Écrans plus étroits : identité puis personnalisation, rubriques en ligne ; la page défile en entier. */
@media (max-width: 1100px) {
  body[data-fond="profil"] {
    overflow-y: auto;
  }

  .profil-trois-colonnes {
    grid-template-columns: 180px minmax(0, 1fr);
  }

  .profil-personnalisation {
    grid-column: 2;
    position: static;
  }
}

@media (max-width: 760px) {
  .profil-trois-colonnes {
    grid-template-columns: minmax(0, 1fr);
  }

  .profil-nav,
  .profil-personnalisation {
    position: static;
    grid-column: auto;
  }

  .profil-rubriques {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .profil-rubrique {
    border-left: 0;
    border-bottom: 3px solid transparent;
    border-radius: 6px 6px 0 0;
  }

  .profil-rubrique.actif {
    border-bottom-color: var(--profil-saphir);
  }
}

/* ----- Identité compacte : écrans de résultats (Solo, duel) ----- */
.profil-identite {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--profil-ivoire);
}

.profil-identite .profil-avatar {
  width: 84px;
}

.profil-identite-pseudo {
  max-width: 12em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--profil-or-clair);
  font-family: "Cinzel", Georgia, serif;
  font-size: 1rem;
}

.profil-identite-role {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.8;
}

/* Pseudo non conforme à la modération : jamais affiché (texte de remplacement, discret). */
.profil-entete-pseudo.pseudo-masque {
  font-style: italic;
  opacity: 0.7;
}

/* ----- Directive V1.9-A : identité neutre (vérification du compte en cours ou impossible) ----- */
.profil-avatar-vide {
  position: absolute;
  inset: 14%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, rgba(59, 111, 216, 0.28), rgba(14, 16, 24, 0.95) 70%), #0e1018; /* opaque : rien ne transparaît */
}

.profil-badge--neutre .profil-badge-pseudo,
.profil-identite--neutre .profil-identite-pseudo {
  font-style: italic;
  opacity: 0.8;
}

.profil-banniere.profil-banniere--neutre {
  background: linear-gradient(180deg, rgba(14, 16, 24, 0.9), rgba(26, 30, 46, 0.9));
}

.profil-page[data-etat="verification"] .profil-option,
.profil-page[data-etat="indisponible"] .profil-option {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ----- Bannières : image centrée à ses proportions d'origine ; bandes latérales en obsidienne de la charte ----- */
/* (bannière sombre 1200 × 630 dans le bandeau 3:1 ; sans effet visible sur la bannière bleue, qui le remplit). */
.profil-banniere {
  background:
    radial-gradient(ellipse 60% 120% at 50% 50%, rgba(201, 162, 75, 0.1), transparent 70%),
    linear-gradient(90deg, #07080d 0%, #141826 30%, #141826 70%, #07080d 100%);
  box-shadow: inset 0 0 0 1px rgba(201, 162, 75, 0.18), inset 0 0 28px rgba(0, 0, 0, 0.65);
}

.profil-banniere-image {
  object-position: 50% 50%;
}

.profil-liste .profil-liste-vide {
  grid-column: 1 / -1;
  text-align: left;
  font-style: italic;
  opacity: 0.75;
}

/* ----- Peaufinage Alpha 0.1.3 : avatars à cadre doré intégré, choix des Deck Boxes ----- */
/* Portrait carré dont l'image porte déjà un cadre doré circulaire : affiché seul (aucun cadre cosmétique par-dessus),
   découpé en disque sur son propre cadre, à la même emprise qu'un avatar encadré. */
.profil-avatar--encadre .profil-avatar-portrait {
  inset: 3%;
  width: 94%;
  height: 94%;
  clip-path: circle(50% at 50% 50%);
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6));
}

.profil-personnalisation .profil-option--avatar,
.profil-personnalisation .profil-option--deckbox {
  width: calc(33.333% - 10px);
  padding: 6px;
}

.profil-option-nom {
  font-size: 0.88rem;
  line-height: 1.15;
  text-align: center;
}

.profil-choix--deckboxes {
  margin-top: 12px;
}

/* ----- Lot B (premier parcours) : accueil du compte qui vient d'être créé (profil.html?bienvenue=1) ----- */
.profil-bienvenue {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  max-width: 1500px;
  margin: 0 auto 14px;
  padding: 14px 20px;
  border: 1px solid var(--profil-or, #c9a24b);
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(59, 111, 216, 0.22), rgba(11, 13, 20, 0.9) 60%);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  color: var(--profil-ivoire, #f3ead6);
}
.profil-bienvenue[hidden] {
  display: none;
}
.profil-bienvenue-texte {
  flex: 1 1 420px;
  min-width: 0;
}
.profil-bienvenue-titre {
  margin: 0 0 4px;
  color: var(--profil-or-clair, #e8c87a);
  font-family: "Cinzel", Georgia, serif;
  font-size: clamp(1.1rem, 1.8vw, 1.45rem);
  letter-spacing: 0.04em;
  overflow-wrap: anywhere;
}
.profil-bienvenue-texte p {
  margin: 0;
  line-height: 1.45;
}
.profil-bienvenue-menu {
  flex: none;
  text-decoration: none;
  white-space: nowrap;
}
@media (max-width: 560px) {
  .profil-bienvenue-menu {
    flex: 1 1 100%;
    text-align: center;
    white-space: normal;
  }
}
