/* muse-app.css — Coque d'application commune à LATRACTION Muse
 * En-tête à onglets (ordinateur), barre d'onglets en bas (mobile),
 * transitions fluides entre les pages de l'univers Muse.
 * Activée par assets/muse-app.js (classe .muse-app sur <body>).
 * ============================================================ */

body.muse-app {
  --ma-accent: #8b5cf6;
  --ma-accent-soft: rgba(139, 92, 246, .16);
  --ma-header-h: 64px;
  --ma-tabbar-h: 64px;
}
body.muse-app[data-muse-section="community"] { --ma-accent: #22d3ee; --ma-accent-soft: rgba(34, 211, 238, .14); }
body.muse-app[data-muse-section="shape"]     { --ma-accent: #fb7185; --ma-accent-soft: rgba(251, 113, 133, .15); }
body.muse-app[data-muse-section="profile"]   { --ma-accent: #c4b5fd; --ma-accent-soft: rgba(196, 181, 253, .14); }

/* L'ancienne navigation de chaque page est remplacée par la coque. */
body.muse-app .muse-nav,
body.muse-app .p-nav,
body.muse-app .mu-bottom { display: none !important; }

/* Doit l'emporter sur site-unified.css, dont le :is(section[id], .unified-grid [id])
   pèse (0,3,1) et impose 100px : html + classe doublée → (0,3,2). */
html body.muse-app.muse-app [id] { scroll-margin-top: calc(var(--ma-header-h) + 12px); }

/* ── En-tête ─────────────────────────────────────────────── */
.ma-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--ma-header-h);
  background: rgba(10, 8, 14, .82);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  view-transition-name: ma-header;
}
.ma-header-inner {
  max-width: 1240px;
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.ma-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #f5f3ff;
  flex-shrink: 0;
}
.ma-brand img { width: 34px; height: 34px; object-fit: contain; }
.ma-brand span { display: flex; flex-direction: column; line-height: 1.05; font: 700 18px 'Syne', 'DM Sans', sans-serif; }
.ma-brand b { font: 600 9px 'DM Sans', sans-serif; letter-spacing: .14em; color: #a4afb5; }

.ma-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0 auto;
  padding: 4px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 999px;
}
.ma-tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  font: 500 13.5px 'DM Sans', sans-serif;
  color: #b8b2c4;
  text-decoration: none;
  transition: color .2s ease, background .2s ease;
}
.ma-tab svg { width: 16px; height: 16px; flex-shrink: 0; }
.ma-tab:hover { color: #fff; background: rgba(255, 255, 255, .05); }
.ma-tab[aria-current="page"] { color: #fff; background: var(--ma-accent-soft); }
.ma-tab[aria-current="page"] svg { color: var(--ma-accent); }

.ma-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.ma-cta {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
  font: 600 13.5px 'DM Sans', sans-serif;
  text-decoration: none;
  box-shadow: 0 6px 20px rgba(124, 58, 237, .35);
  transition: transform .15s ease, box-shadow .2s ease;
}
.ma-cta:hover { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(124, 58, 237, .45); }
.ma-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .09);
  background: rgba(255, 255, 255, .04);
  color: #d8d2e4;
  text-decoration: none;
  transition: border-color .2s ease, background .2s ease;
  cursor: pointer;
}
.ma-icon-btn svg { width: 19px; height: 19px; }
.ma-icon-btn:hover { border-color: var(--ma-accent); background: var(--ma-accent-soft); color: #fff; }
.ma-avatar.is-signed { background: var(--ma-accent-soft); border-color: var(--ma-accent); font: 700 13px 'DM Sans', sans-serif; color: #fff; overflow: hidden; }
.ma-avatar img, .ma-tabbar-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

/* Notifications et messages privés */
.ma-icon-btn[hidden] { display: none !important; }
.ma-social { position: relative; font: inherit; }
.ma-count {
  position: absolute; top: -3px; right: -3px; display: grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: #22d3ee; color: #04161b; font: 800 10.5px/1 'DM Sans', sans-serif; box-shadow: 0 0 0 2px #0a080e;
}
.ma-count[hidden] { display: none; }
.ma-notif {
  position: absolute; top: calc(100% + 8px); right: 16px; z-index: 1001; width: min(380px, calc(100vw - 16px)); max-height: min(520px, 70vh);
  overflow-y: auto; border-radius: 18px; background: #11161a; border: 1px solid rgba(255, 255, 255, .1);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55); color: #e6f6f8; font-family: 'DM Sans', sans-serif;
}
.ma-notif[hidden] { display: none; }
.ma-notif ul { list-style: none; margin: 0; padding: 6px; }
.ma-notif li a, .ma-notif li > div { display: grid; grid-template-columns: 36px 1fr; gap: 10px; align-items: start; padding: 10px; border-radius: 12px; color: inherit; text-decoration: none; }
.ma-notif li a:hover { background: rgba(255, 255, 255, .05); }
.ma-notif li.is-new a, .ma-notif li.is-new > div { background: rgba(34, 211, 238, .08); }
.ma-notif-av { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; overflow: hidden; background: linear-gradient(135deg, #0e7490, #22d3ee); color: #04161b; font: 800 12px 'Syne', sans-serif; }
.ma-notif-av img { width: 100%; height: 100%; object-fit: cover; }
.ma-notif-text { display: block; font-size: 13.5px; line-height: 1.45; }
.ma-notif small { display: block; margin-top: 2px; font-size: 11.5px; color: rgba(236, 254, 255, .5); }
.ma-notif-empty { margin: 0; padding: 22px 18px; font-size: 13.5px; line-height: 1.55; color: rgba(236, 254, 255, .6); text-align: center; }

.ma-header a:focus-visible,
.ma-tabbar a:focus-visible,
.ma-icon-btn:focus-visible { outline: 2px solid var(--ma-accent); outline-offset: 2px; }

/* Largeurs moyennes : les icônes Messages et Notifications prennent de la place.
   On masque d'abord « Quitter Muse », puis les intitulés des onglets (gardés pour les lecteurs d'écran). */
@media (min-width: 861px) and (max-width: 1200px) {
  .ma-exit { display: none; }
  .ma-actions { gap: 8px; }
}
@media (min-width: 861px) and (max-width: 1120px) {
  .ma-tab { padding: 0 12px; }
  .ma-tab span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* ── Barre d'onglets mobile ──────────────────────────────── */
.ma-tabbar { display: none; }

@media (max-width: 860px) {
  body.muse-app { --ma-header-h: 56px; }
  .ma-header-inner { padding: 0 14px; gap: 10px; }
  .ma-tabs, .ma-exit, .ma-avatar { display: none; }
  .ma-social { width: 40px; height: 40px; }
  .ma-actions { gap: 8px; }
  .ma-notif { right: 8px; }
  .ma-actions { margin-left: auto; }
  .ma-cta { min-height: 38px; padding: 0 16px; font-size: 13px; box-shadow: none; }
  .ma-brand span { font-size: 16px; }

  .ma-tabbar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    height: calc(var(--ma-tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(10, 8, 14, .9);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    border-top: 1px solid rgba(255, 255, 255, .08);
    view-transition-name: ma-tabbar;
  }
  .ma-tabbar a {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font: 500 10.5px 'DM Sans', sans-serif;
    color: #9d97aa;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
  }
  .ma-tabbar a svg { width: 22px; height: 22px; transition: transform .2s ease; }
  .ma-tabbar a .ma-tabbar-avatar {
    display: flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--ma-accent-soft); border: 1.5px solid var(--ma-accent);
    font: 700 9.5px 'DM Sans', sans-serif; color: #fff;
  }
  .ma-tabbar a[aria-current="page"] { color: #fff; }
  .ma-tabbar a[aria-current="page"] svg { color: var(--ma-accent); transform: translateY(-1px); }
  .ma-tabbar a[aria-current="page"]::before {
    content: '';
    position: absolute;
    top: 0;
    width: 28px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--ma-accent);
    box-shadow: 0 0 12px var(--ma-accent);
  }
  .ma-tabbar a:active svg { transform: scale(.9); }

  body.muse-app { padding-bottom: calc(var(--ma-tabbar-h) + env(safe-area-inset-bottom)); }
  body.muse-app .wa-float { bottom: calc(var(--ma-tabbar-h) + env(safe-area-inset-bottom) + 14px) !important; }
}

/* ── Transitions fluides entre les pages Muse ───────────── */
/* La règle d'ouverture (@view-transition) est posée en ligne dans le <head> de chaque page Muse :
 * dans cette feuille externe elle arrive trop tard et le navigateur abandonne la transition avec une erreur. */
::view-transition-old(root),
::view-transition-new(root) { animation-duration: .26s; animation-timing-function: cubic-bezier(.2, .7, .3, 1); }
@media (prefers-reduced-motion: reduce) {
  .ma-tab, .ma-cta, .ma-tabbar a svg { transition: none; }
}

/* Pochette neutre de l'accueil Muse (logo à la place d'un studio en particulier) */
.im-record-sleeve--muse { background: linear-gradient(145deg, #4c1d95, #7c3aed); display: grid; place-items: center; }
.im-record-sleeve--muse img { width: 62%; height: 62%; object-fit: contain; }

/* Lien Administration, discret, en bas de page */
.ma-admin-link { display: inline-block; font: 500 12px 'DM Sans', sans-serif; color: rgba(245, 243, 255, .45); text-decoration: none; padding: 12px 8px; }
.ma-admin-link:hover, .ma-admin-link:focus-visible { color: #fff; text-decoration: underline; }
.ma-admin-link--footer { display: block; margin-top: 8px; text-align: center; }
.ma-admin-line { text-align: center; padding: 8px 0 calc(var(--ma-tabbar-h, 0px) + 12px); }
@media (min-width: 861px) { .ma-admin-line { padding-bottom: 12px; } }
