/* ==========================================================================
   SexyShare — Design V2 (lot v2c)
   Base : lot v2a/v2b + styles bandeau profil (proposition validée le 05/12/2026).
   Tout est scopé sous html[data-layout="v2"], sauf le bouton V1 / V2 lui-même
   (présent dans les deux designs, placé en absolu pour ne rien décaler en V1).
   ========================================================================== */

/* ---------- Bouton V1 / V2 (toujours présent, hors flux) ---------- */
.ss-layout-switch {
  position: absolute;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--border, rgba(255, 130, 170, 0.3));
  background: var(--bg-elevated, rgba(255, 232, 240, 0.9));
  line-height: 1;
}
.ss-layout-switch__btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 5px 9px;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted, #7d4d62);
  min-width: 30px;
}
.ss-layout-switch__btn.is-active {
  background: #c2185b; /* blanc dessus : 5,9:1 */
  color: #fff;
}
.ss-layout-switch__btn:focus-visible { outline: 2px solid var(--accent, #ff6b9d); outline-offset: 2px; }

/* Bouton inactif : lisible (≥ 4,5:1) dans les 5 thèmes */
html[data-theme="soft"] .ss-layout-switch__btn:not(.is-active),
html[data-theme="cyberlight"] .ss-layout-switch__btn:not(.is-active) { color: #6b3a4e; }
html[data-theme="cyber"] .ss-layout-switch__btn:not(.is-active),
html[data-theme="fantasy"] .ss-layout-switch__btn:not(.is-active),
html[data-theme="vampire"] .ss-layout-switch__btn:not(.is-active) { color: #e8d5df; }

/* Ordinateur : dans l'espace libre entre la recherche et le sélecteur de thème */
.nav__actions { position: relative; }
.ss-layout-switch--nav { right: calc(100% + 14px); top: 50%; transform: translateY(-50%); }

/* Menu mobile : à droite du titre « Thème » */
.mobile-menu__section { position: relative; }
.ss-layout-switch--menu { right: 4px; top: 50%; transform: translateY(-50%); }
.ss-layout-switch--nav { display: inline-flex; }
@media (max-width: 900px) {
  .ss-layout-switch--nav { display: none; }
}
@media (min-width: 901px) {
  .ss-layout-switch--menu { display: none; }
}

/* ==========================================================================
   V2
   ========================================================================== */

/* --- Onglets collants : overflow-x:hidden sur html/body empêchait position:sticky.
       clip garde le même rendu (pas de défilement horizontal) sans bloquer sticky. --- */
html[data-layout="v2"],
html[data-layout="v2"] body { overflow-x: clip; }

/* --- Profil compact (option B) --- */
html[data-layout="v2"] #page-profile .cp-cover { height: 176px; min-height: 0; max-height: 176px; }
html[data-layout="v2"] #page-profile .cp-shell > .cp-links { display: none; }          /* doublon : liens déjà dans « Retrouve … sur » et l'onglet Liens */
html[data-layout="v2"] #page-profile .ss4-plats { margin: 8px 0 2px; }
html[data-layout="v2"] #page-profile .ss4-plats__title { display: none; }
html[data-layout="v2"] #page-profile .ss4-plat { padding-top: 8px; padding-bottom: 8px; min-height: 0; }
html[data-layout="v2"] #page-profile .cp-tabs.profile-tabs { margin-top: 12px; }

/* Panneau « À propos » (contenu déplacé : bio, statistiques, liens) */
html[data-layout="v2"] .ss-v2-about-panel { padding: 6px 0 10px; }
html[data-layout="v2"] .ss-v2-about-panel .cp-about { display: block; margin-top: 6px; }
html[data-layout="v2"] .ss-v2-about-panel .cp-links { display: block; margin-top: 16px; }

/* --- Barre profil collante (apparaît quand l'identité a défilé) --- */
.ss-v2-bar { display: none; }
html[data-layout="v2"] .ss-v2-bar {
  position: fixed;
  left: 0; right: 0;
  top: 0;
  z-index: 95;                 /* sous la nav (100), au-dessus du contenu */
  display: flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 16px;
  background: var(--bg-card, #fff);
  color: var(--text, #4a2c3a);
  border-bottom: 1px solid var(--border, rgba(0,0,0,.08));
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  transform: translateY(calc(-100% - var(--ss-v2-stick, 160px) - 8px));
  visibility: hidden;
  transition: transform .18s ease, visibility 0s linear .18s;
  pointer-events: none;
}
html[data-layout="v2"] .ss-v2-bar.is-on { transform: translateY(0); visibility: visible; transition: transform .18s ease; pointer-events: auto; }

/* En-tête du site en V2 : le bandeau BETA et la nav sont tous deux sticky top:0 ;
   quand le sticky redevient actif (overflow-x: clip), la nav se cale sous le bandeau. */
html[data-layout="v2"] nav.nav { top: var(--ss-v2-ann, 0px); }

/* Identité cliquable : remonte en haut du profil */
.ss-v2-bar__ident {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
  max-width: 100%;
  padding: 0;
  margin: 0;
  cursor: pointer;
  text-align: left;
}
.ss-v2-bar__ident:hover .ss-v2-bar__name { text-decoration: underline; text-underline-offset: 3px; }
.ss-v2-bar__ident:focus-visible { outline: 2px solid var(--accent, #ff6b9d); outline-offset: 2px; border-radius: 8px; }
.ss-v2-bar__text { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.ss-v2-bar__av {
  width: 34px; height: 34px; border-radius: 50%; overflow: hidden; flex: none;
  background: var(--bg-elevated, rgba(0,0,0,.06));
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; line-height: 1;
}
.ss-v2-bar__av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ss-v2-bar__name { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss-v2-bar__handle { opacity: .7; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: none; }
.ss-v2-bar__sp { flex: 0 0 8px; }
.ss-v2-bar__follow { flex: none !important; white-space: nowrap; min-width: 5.5em; }
html[data-layout="v2"] .ss-v2-bar__follow[hidden] { display: none !important; }

/* Cohérence des 5 thèmes (ne pas dépendre uniquement de --bg-card, qui peut manquer). */
html[data-layout="v2"][data-theme="soft"] .ss-v2-bar {
  background: #ffffff; color: #4a2c3a; border-bottom-color: rgba(255, 130, 170, 0.22);
}
html[data-layout="v2"][data-theme="cyberlight"] .ss-v2-bar {
  background: #ffffff; color: #0b1426; border-bottom-color: rgba(0, 150, 190, 0.24);
}
html[data-layout="v2"][data-theme="cyber"] .ss-v2-bar {
  background: #0a0a18; color: #e8f7ff; border-bottom-color: rgba(0, 240, 255, 0.22);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
}
html[data-layout="v2"][data-theme="fantasy"] .ss-v2-bar {
  background: #15101f; color: #f6edf8; border-bottom-color: rgba(232, 184, 74, 0.22);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
}
html[data-layout="v2"][data-theme="vampire"] .ss-v2-bar {
  background: #171014; color: #f4e8ec; border-bottom-color: rgba(200, 120, 140, 0.22);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
}

@media (max-width: 720px) {
  .ss-v2-bar__handle { display: none; } /* laisse la place au bouton */
}

/* Onglets du profil collés sous la barre collante quand elle est visible */
html[data-layout="v2"] #page-profile .cp-tabs.profile-tabs {
  top: calc(var(--ss-v2-stick, 0px) + 52px);
}

/* ---------- Mobile ---------- */
@media (max-width: 720px) {
  /* option C : en-tête du site allégé (bandeau BETA et sélecteur de thème restent dans le menu / fermables) */
  html[data-layout="v2"] #site-announce { display: none !important; }
  html[data-layout="v2"] .nav .theme-switch { display: none !important; }

  html[data-layout="v2"] #page-profile .cp-cover { height: 96px; max-height: 96px; }
  html[data-layout="v2"] #page-profile .cp-avatar { width: 84px; height: 84px; padding: 3px; margin-top: -44px; }
  html[data-layout="v2"] #page-profile .cp-avatar .avatar,
  html[data-layout="v2"] #page-profile .cp-avatar .avatar--xxl { width: 78px !important; height: 78px !important; }

  /* Plateformes : rail horizontal au lieu de 4 cartes empilées */
  html[data-layout="v2"] #page-profile .ss4-plats__grid {
    display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 8px;
    scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
  }
  html[data-layout="v2"] #page-profile .ss4-plat { flex: 0 0 150px; scroll-snap-align: start; }

  /* Actions sur une seule ligne, sans débordement */
  html[data-layout="v2"] #page-profile .cp-actions {
    flex-wrap: nowrap;
    width: 100%;
    max-width: 100%;
    justify-content: center;
    gap: 6px;
  }
  html[data-layout="v2"] #page-profile .cp-actions > .btn { flex: 1 1 0; min-width: 0; min-height: 44px; padding-left: 8px; padding-right: 8px; }
  html[data-layout="v2"] #page-profile .cp-actions > .cp-icon-btn { flex: 0 0 44px; width: 44px; height: 44px; }
  html[data-layout="v2"] #page-profile .cp-actions > [hidden] { display: none !important; }

  /* Bas d'écran : le dock « X → » (doublon de lien) est masqué ; plus de chevauchement avec la mascotte / le Hub */
  html[data-layout="v2"] .cp-dock { display: none !important; }
  html[data-layout="v2"] body.is-profile-page .main { padding-bottom: 24px; }
}

/* ---------- /coomeet : texte lisible sur le panneau sombre, thèmes clairs ---------- */
html[data-layout="v2"][data-theme="soft"] .coomeet-launch__title,
html[data-layout="v2"][data-theme="cyberlight"] .coomeet-launch__title { color: #ffffff; }
html[data-layout="v2"][data-theme="soft"] .coomeet-launch__text,
html[data-layout="v2"][data-theme="cyberlight"] .coomeet-launch__text,
html[data-layout="v2"][data-theme="soft"] .coomeet-launch__note,
html[data-layout="v2"][data-theme="cyberlight"] .coomeet-launch__note { color: #f3e6ee; }
html[data-layout="v2"][data-theme="soft"] .coomeet-launch__acts .btn--outline,
html[data-layout="v2"][data-theme="cyberlight"] .coomeet-launch__acts .btn--outline {
  color: #ffffff; border-color: rgba(255, 255, 255, 0.7); background: rgba(255, 255, 255, 0.08);
}

/* ---------- Contraste du thème soft (V2 uniquement) ---------- */
html[data-layout="v2"][data-theme="soft"] {
  --text-muted: #74465a;
}
html[data-layout="v2"][data-theme="soft"] .ss4-tag,
html[data-layout="v2"][data-theme="soft"] a.post-link,
html[data-layout="v2"][data-theme="soft"] .cp-link__go,
html[data-layout="v2"][data-theme="soft"] .ss-pcard__more,
html[data-layout="v2"][data-theme="soft"] .creator-rail__cta,
html[data-layout="v2"][data-theme="soft"] .site-announce__link,
html[data-layout="v2"][data-theme="soft"] .guest-join__badge,
html[data-layout="v2"][data-theme="soft"] .tiktok-promo__cta,
html[data-layout="v2"][data-theme="soft"] .lang-btn.active,
html[data-layout="v2"][data-theme="soft"] .tab.active,
html[data-layout="v2"][data-theme="soft"] .cp-tabs__count,
html[data-layout="v2"][data-theme="soft"] .cp-stat strong {
  color: #9d174d;
}
html[data-layout="v2"][data-theme="soft"] .level-badge__emoji,
html[data-layout="v2"][data-theme="soft"] .level-badge__label { color: #5b21b6; }
html[data-layout="v2"][data-theme="cyberlight"] .level-badge__emoji,
html[data-layout="v2"][data-theme="cyberlight"] .level-badge__label,
html[data-layout="v2"][data-theme="cyberlight"] .level-badge--elite { color: #5b21b6; }
/* texte blanc sur fond rose : fond plus foncé */
html[data-layout="v2"][data-theme="soft"] .site-announce__badge,
html[data-layout="v2"][data-theme="soft"] .ss-vcard__cta { background: #c2185b; color: #fff; }

/* ---------- Focus clavier visible (P2, faible risque) ---------- */
html[data-layout="v2"] :focus-visible { outline: 3px solid var(--accent, #ff6b9d); outline-offset: 2px; }

/* Bas d'écran mobile, accueil : le bouton ↑ (#ss-back-top) recouvrait le bouton plein écran (.ss4-fab).
   On le remonte juste au-dessus (fab : bottom 84 px, hauteur 56 px). */
@media (max-width: 720px) {
  html[data-layout="v2"] body:has(#page-home.active) #ss-back-top {
    bottom: calc(150px + env(safe-area-inset-bottom, 0px));
  }
}
