/* ==========================================================================
   Stellion — fil d'actualité
   Maquettes : FilMenu, FilMenuOuvert, FilMenuClair (en-tête à menu), Fil.
   La carte de publication est un composant (css/components.css, section 12).
   ========================================================================== */

/* Affichée par le JS (style.display = 'flex') */
.st-feed-view {
  flex: 1;
  min-width: 0;
  display: none;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
  position: relative;
}

/* ---------- En-tête ---------- */

.st-feed-head {
  flex-shrink: 0;
  height: var(--header-h);
  padding: 0 var(--space-2) 0 var(--space-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  transition: margin-top var(--duration-base) var(--ease-out);
}

/* Rangé quand on descend dans le fil, revient dès qu'on remonte (mobile.js) */
.st-feed-head.hub-hidden {
  margin-top: calc(var(--header-h) * -1);
}

.st-feed-head__start,
.st-feed-head__end {
  display: flex;
  align-items: center;
}

.st-feed-head__start {
  gap: var(--space-1);
  min-width: 0;
}

.st-feed-head__title {
  width: auto;
  min-width: 0;
  height: var(--tap-min);
  margin: 0;
  padding: 0 var(--space-2) 0 10px;
  border: 0;
  border-radius: var(--radius-md);
  background: none;
  box-shadow: none;
  color: var(--text);
  font: inherit;
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-title);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.st-feed-head__title:hover {
  background: var(--surface-2);
  filter: none;
  transform: none;
  box-shadow: none;
}

.st-feed-head__title > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.st-feed-head__title > svg {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 220ms ease;
}

.st-feed-head__title[aria-expanded="true"] > svg {
  transform: rotate(180deg);
}

.st-feed-head__dots {
  padding-left: 2px;
  display: flex;
  gap: var(--space-1);
}

.st-feed-head__dots[hidden] {
  display: none;
}

.st-feed-head__dots > span {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--border-strong);
  transition: background-color 220ms ease;
}

.st-feed-head__dots > .is-on {
  background: var(--accent);
}

.st-feed-head__bell {
  position: relative;
}

.st-feed-head__bell-dot {
  position: absolute;
  top: 10px;
  right: 11px;
  width: 9px;
  height: 9px;
  border: 2px solid var(--bg);
  border-radius: var(--radius-full);
  background: var(--accent);
}

.st-feed-head__bell-dot[hidden] {
  display: none;
}

/* ---------- Recherche ---------- */

/* Affichée par le JS (style.display = 'flex') */
.st-feed-search {
  flex-shrink: 0;
  height: var(--header-h);
  padding: 0 var(--space-2);
  display: none;
  align-items: center;
  gap: var(--space-1);
  background: var(--bg);
}

.st-feed-search__field {
  flex: 1;
  min-width: 0;
}

/* Affiché par le JS quand le champ n'est pas vide */
.st-feed-search__clear {
  display: none;
}

.st-feed-discovery {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: var(--space-3) var(--space-4);
}

/* ---------- Menu du titre ---------- */

.st-feed-menu {
  width: 272px;
  padding: 6px;
}

.st-feed-menu .st-menu__item {
  min-height: 48px;
}

.st-feed-menu__section {
  min-height: var(--tap-min);
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-regular);
  color: var(--text-muted);
}

.st-feed-menu__section > svg {
  color: var(--text-muted);
  transition: transform 220ms ease;
}

.st-feed-menu__section[aria-expanded="true"] > svg {
  transform: rotate(180deg);
}

.st-feed-menu__nexus {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.st-feed-menu__nexus[hidden],
.st-feed-menu__admin[hidden] {
  display: none;
}

.st-feed-menu__search {
  min-height: 40px;
  margin: 0 6px var(--space-1);
  padding: 0 10px;
  border-radius: var(--radius-sm);
  gap: var(--space-2);
}

.st-feed-menu__search > input {
  height: 40px;
  font-size: var(--text-md);
}

.st-feed-menu__list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.st-feed-menu__label {
  padding: var(--space-1) var(--space-3) 2px;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  color: var(--text-muted);
}

.st-feed-menu__all {
  justify-content: space-between;
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  color: var(--accent-text);
}

.st-feed-menu__all > svg {
  color: var(--accent-text);
}

/* Pastille d'un nexus : son image, ou son initiale */
.st-nexus-mark {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: var(--radius-xs);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.st-nexus-mark > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* L'entrée Administration n'apparaît que pour l'équipe (profile.js : style.display) */
.st-feed-menu__admin {
  display: none;
}

/* ---------- Zone défilante, stories ---------- */

#hub-scroll-area {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.st-stories {
  flex-shrink: 0;
  padding: var(--space-4) var(--space-4) 14px;
  display: flex;
  gap: var(--space-4);
  overflow-x: auto;
  scrollbar-width: none;
}

.st-stories::-webkit-scrollbar {
  display: none;
}

.st-story {
  width: 62px;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  color: var(--text);
  font: inherit;
  letter-spacing: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.st-story:hover {
  filter: none;
  transform: none;
  box-shadow: none;
}

.st-story__add {
  width: 58px;
  height: 58px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.st-story__add--sm {
  width: var(--avatar-md);
  height: var(--avatar-md);
  flex-shrink: 0;
}

.st-story__ring {
  flex-shrink: 0;
  padding: 3px;
  border: 2px solid var(--accent);
  border-radius: var(--radius-full);
  display: flex;
}

.st-story__ring.is-seen {
  border-color: var(--border-strong);
}

.st-story__ring > .st-avatar {
  --avatar-size: 34px;
}

.st-story__ring--lg > .st-avatar {
  --avatar-size: 48px;
}

.st-story__name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-xs);
  font-weight: var(--weight-regular);
}

.st-story:first-child > .st-story__name {
  color: var(--text-muted);
}

.st-stories-side__empty {
  margin: 0;
  padding: var(--space-3);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  text-align: center;
  color: var(--text-muted);
}

/* ---------- Fil ---------- */

.st-feed__sentinel {
  width: 100%;
  height: 1px;
}

/* Place pour la barre flottante et le bouton « créer » sous la dernière publication */
#hub-feed-content {
  padding-bottom: calc(var(--nav-space) + var(--space-8));
}

/* Squelette pendant le chargement : mêmes dimensions qu'une publication courte */
.st-post-skeleton {
  padding: 14px var(--space-4) var(--space-4);
  border-bottom: 1px solid var(--hairline);
  display: grid;
  grid-template-columns: var(--avatar-md) 1fr;
  gap: 10px;
}

.st-post-skeleton > .st-skeleton:nth-child(1) { width: var(--avatar-md); height: var(--avatar-md); border-radius: var(--radius-full); grid-row: span 2; }
.st-post-skeleton > .st-skeleton:nth-child(2) { width: 40%; height: 14px; align-self: end; }
.st-post-skeleton > .st-skeleton:nth-child(3) { width: 25%; height: 10px; }
.st-post-skeleton > .st-skeleton:nth-child(4) { grid-column: 1 / -1; height: 14px; }
.st-post-skeleton > .st-skeleton:nth-child(5) { grid-column: 1 / -1; width: 70%; height: 14px; }

/* Publier : bouton flottant sur mobile, bandeau au-dessus du fil sur ordinateur */
.st-feed-fab {
  position: absolute;
  right: var(--space-4);
  bottom: calc(var(--nav-space) + var(--space-3));
  z-index: 5;
  transition: transform var(--duration-base) var(--ease-out);
}

/* Descente dans le fil : le bouton part vers le bas avec la barre flottante (mobile.js) */
.st-feed-view--away .st-feed-fab {
  transform: translateY(calc(var(--nav-space) + 56px + var(--space-3)));
}

.st-feed-composer {
  display: none;
}

@media (min-width: 769px) {
  .st-feed-fab {
    display: none;
  }

  .st-feed-composer {
    width: 100%;
    min-height: 56px;
    margin: 0 0 var(--space-3);
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-xl);
    background: var(--surface);
    box-shadow: none;
    color: var(--text-muted);
    font: inherit;
    font-size: var(--text-base);
    font-weight: var(--weight-regular);
    letter-spacing: 0;
    text-align: left;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
  }

  .st-feed-composer:hover {
    filter: none;
    transform: none;
    box-shadow: none;
    border-color: var(--border-strong);
  }

  .st-feed-composer__avatar {
    display: flex;
  }

  .st-feed-composer__text {
    flex: 1;
  }

  .st-feed-composer__cta {
    height: 36px;
    padding: 0 var(--space-4);
    border-radius: var(--radius-md);
    background: var(--accent);
    color: var(--on-accent);
    font-size: var(--text-md);
    font-weight: var(--weight-semibold);
    display: flex;
    align-items: center;
  }

  /* Ordinateur (mise en page provisoire, refaite à l'étape 4) : fil en cartes centrées */
  #hub-feed-content.st-feed {
    border-top: 0;
    background: none;
    gap: 10px;
  }

  #hub-feed-content.st-feed > .st-post {
    border: 1px solid var(--hairline);
    border-radius: var(--radius-xl);
    background: var(--surface);
  }

  .st-stories {
    display: none;
  }
}

/* ---------- Recherche vide : récentes et tendances ---------- */

.st-feed-discovery__section + .st-feed-discovery__section {
  margin-top: var(--space-6);
}

.st-feed-discovery__title {
  margin: 0 0 var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-regular);
  color: var(--text-muted);
}

.st-feed-discovery__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.st-feed-discovery__recent {
  display: flex;
  align-items: center;
}

.st-feed-discovery__recent > .st-row-btn {
  flex: 1;
  min-width: 0;
  min-height: var(--tap-min);
  color: var(--text);
}

.st-feed-discovery__recent > .st-row-btn > svg {
  flex-shrink: 0;
  color: var(--text-muted);
}

.st-feed-discovery__chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.st-feed-discovery__empty {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* ---------- Mise en page : colonne du fil, stories à droite sur grand écran ---------- */

.hub-layout-wrapper {
  width: 100%;
  margin: 0 auto;
}

.hub-feed-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.hub-stories-sidebar {
  display: none;
}

@media (min-width: 769px) {
  #hub-scroll-area {
    padding: var(--space-5) var(--space-6);
  }

  .hub-layout-wrapper {
    max-width: 980px;
    display: flex;
    align-items: flex-start;
    gap: var(--space-6);
  }

  .hub-feed-col {
    flex: 1;
    max-width: 640px;
  }

  #hub-feed-content {
    padding-bottom: var(--space-10);
  }
}

@media (min-width: 1024px) {
  .hub-stories-sidebar {
    width: 272px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    padding: var(--space-2);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-xl);
    background: var(--surface);
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .stories-sidebar-header {
    padding: var(--space-2) var(--space-2) var(--space-1);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-muted);
  }

  .stories-sidebar-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
}
