/**
 * SCRIBONAUTES — Page profil utilisateur
 * pages/profile.css
 */

.profile-page {
  background: var(--bg);
  min-height: calc(100vh - 64px);
  padding-bottom: 80px;
}

/* ============================================================
   HEADER
   ============================================================ */
.profile-header {
  margin-bottom: 48px;
}

/* Bandeau — élément de flux normal (pas absolu) */
.profile-header-bg {
  position: relative;
  height: 285px;           /* 4:1 à 1140px — correspond au ratio du crop (1200×300) */
  background: var(--gradient-hero);
  background-size: cover;
  background-position: top center;
}

/* Fondu bas vers la couleur de fond de page */
.profile-header-bg::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 72px;
  background: linear-gradient(to bottom, transparent, var(--bg));
  pointer-events: none;
}

/* Rangée principale : gauche (avatar + info) | droite (actions) */
.profile-header-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-top: -68px;   /* avatar chevauche le bas du bandeau */
  padding-bottom: 16px;
  position: relative;  /* s'affiche par-dessus le ::after du bg */
}

/* Côté gauche : avatar + nom, alignés en bas */
.profile-header-left {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  flex: 1;
  min-width: 0;        /* permet la troncature du texte long */
}

/* Avatar */
.profile-avatar-wrap {
  flex-shrink: 0;
  filter: drop-shadow(var(--shadow-lg));
}

.profile-avatar-img {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 4px solid var(--surface);
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.75rem;
  font-family: var(--font-display);
  font-weight: 700;
  color: white;
}

/* Info */
.profile-info {
  flex: 1;
  min-width: 0;
  padding-bottom: 8px;
}

.profile-meta-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.profile-level {
  background: var(--accent-light) !important;
  color: var(--accent) !important;
  font-size: 0.7rem !important;
}

.profile-name {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -0.02em;
  overflow-wrap: break-word;
}

.profile-username {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: 0;
}

/* Actions — côté droit, flush en haut de la zone sous le bandeau */
.profile-actions {
  flex-shrink: 0;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  flex-wrap: wrap;
  justify-content: flex-end;
  padding-top: 72px;   /* compense le margin-top négatif pour rester sous le bandeau */
  max-width: 340px;
}

.profile-bio {
  font-family: var(--font-body);
  font-style: italic;
  color: var(--text-mid);
  font-size: var(--text-md);
  line-height: 1.65;
  max-width: 720px;
  margin: 0;
}

/* Bio + social links + stats, sous la bannière */
.profile-header-below {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 0 4px;
}

.profile-social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.profile-social-links:empty {
  display: none;
}

.profile-social-item {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--trans-base);
}

a.profile-social-item:hover {
  color: var(--accent);
}

.profile-stats {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
}

.profile-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profile-stat-value {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.profile-stat-label {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── Lisibilité sur bannière personnalisée ──────────────────────
   Fond frosted-glass sur le bloc texte (nom, pseudo, labels)
   quand une image de couverture est présente.
   ──────────────────────────────────────────────────────────── */
.profile-header.has-cover .profile-info {
  background: rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius-md);
  padding: 10px 14px;
}

.profile-header.has-cover .profile-name {
  color: #fff;
}

.profile-header.has-cover .profile-username {
  color: rgba(255, 255, 255, 0.75);
}

.profile-header.has-cover .profile-meta-top .scrib-label {
  color: rgba(255, 255, 255, 0.9) !important;
  border-color: rgba(255, 255, 255, 0.25) !important;
}

/* ============================================================
   CONTENT
   ============================================================ */
.profile-content {
  display: flex;
  flex-direction: column;
  gap: 48px;
}

.profile-section-header {
    display: flex;
    align-items: center;
    text-align: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-direction: column;
    row-gap: 1em;
}

.profile-section-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

/* Grille d'œuvres */
.profile-works-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.profile-work-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: all var(--trans-base);
  display: block;
}

.profile-work-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent-mid);
  color: inherit;
}

.profile-work-cover {
  width: 100%;
  height: 160px;
  object-fit: cover;
}

.profile-work-cover--placeholder {
  background: var(--gradient-accent);
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  opacity: 0.7;
}

.profile-work-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-work-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.profile-work-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Empty state */
.profile-empty {
  text-align: center;
  padding: 60px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.profile-empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.4;
}

.profile-empty p {
  color: var(--text-muted);
  font-family: var(--font-ui);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .profile-header-bg {
    height: 200px;
  }

  .profile-header-inner {
    flex-direction: column;
    align-items: stretch;
    margin-top: -56px;
    gap: 16px;
  }

  .profile-header-left {
    gap: 16px;
  }

  .profile-actions {
    padding-top: 0;
    max-width: none;
    justify-content: flex-start;
  }

  .profile-stats { gap: 20px; }

  .profile-works-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .profile-works-grid {
    grid-template-columns: 1fr;
  }
}

/* ---- Carte œuvre (surcharge / compléments) ---- */
.profile-work-card {
  position: relative;           /* ancre pour le badge statut */
}
 
/* Description courte */
.profile-work-desc {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
 
/* Auteur (mode show_author) */
.profile-work-author {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin: 0 0 4px;
}
 
/* Stats row */
.profile-work-stats {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}
 
/* Tags */
.profile-work-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 6px;
}
 
.tag-chip {
  font-family: var(--font-ui);
  font-size: 0.68rem;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 2px 8px;
  white-space: nowrap;
}
 
/* Badge statut — coin haut-gauche sur la couverture */
.profile-work-status-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  font-family: var(--font-ui);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 9px;
  border-radius: 99px;
  backdrop-filter: blur(6px);
}
 
/* Couleurs par statut */
.badge-status--draft       { background: rgba(100,100,100,.75); color: #fff; }
.badge-status--in_progress { background: rgba(59,130,246,.80);  color: #fff; }
.badge-status--completed   { background: rgba(34,197,94,.80);   color: #fff; }
.badge-status--published   { background: rgba(34,197,94,.80);   color: #fff; }
.badge-status--archived    { background: rgba(150,100,50,.70);  color: #fff; }
 
/* Badge visibilité */
.badge-visibility {
  font-size: 0.85em;
  padding: 1px 5px;
}
 
/* stat-pill (partagé avec work_list) */
.stat-pill {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 2px 8px;
  white-space: nowrap;
}

.profile-participation-intro {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.75;
  max-width: 640px;
  margin-bottom: 28px;
}

.profile-participation-intro strong {
  color: var(--text-mid);
}