/* ==========================================================================
   Stellion — publication ouverte et commentaires
   Maquettes : PostOuvert (page « Publication »), Commentaires (feuille).
   Une seule fenêtre : #post-dialog, en feuille sur mobile, centrée sur ordinateur.
   ========================================================================== */

.st-post-dialog {
  height: min(620px, calc(100dvh - var(--space-10)));
}

/* Publication ouverte : pleine page sur mobile, grande fenêtre sur ordinateur */
.st-post-dialog--full {
  width: min(640px, calc(100vw - var(--space-8)));
  height: min(860px, calc(100dvh - var(--space-8)));
}

.st-post-dialog__head {
  padding: var(--space-1) var(--space-2) var(--space-1) var(--space-4);
  border-bottom: 1px solid var(--hairline);
  gap: var(--space-1);
}

.st-post-dialog__head > .st-dialog__title {
  flex: 0 1 auto;
}

.st-post-dialog__sub {
  flex: 1;
  min-width: 0;
  padding-left: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* Retour (page) ou fermer (feuille) selon le mode */
.st-post-dialog__back {
  display: none;
}

.st-post-dialog--full .st-post-dialog__back {
  display: inline-flex;
}

.st-post-dialog--full .st-post-dialog__close {
  display: none;
}

.st-post-dialog--full .st-post-dialog__head {
  padding-left: var(--space-2);
}

.st-post-dialog--full .st-dialog__title {
  flex: 1;
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
}

.st-post-dialog__scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: var(--space-2);
}

.st-post-dialog__post[hidden] {
  display: none;
}

/* La publication ouverte n'est pas une carte : pas de filet ni de fond propre */
.st-post-dialog__post > .st-post {
  border-bottom: 1px solid var(--hairline);
}

.st-post-dialog__section {
  display: none;
  margin: 0;
  padding: var(--space-3) var(--space-4) var(--space-1);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
}

.st-post-dialog--full .st-post-dialog__section {
  display: block;
}

.st-post-dialog__comments {
  padding-top: var(--space-2);
}

/* Barre « Réponse à … » accrochée au-dessus du champ */
.st-post-dialog__reply {
  flex-shrink: 0;
  padding: var(--space-1) var(--space-2) var(--space-1) var(--space-4);
  border-top: 1px solid var(--hairline);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.st-post-dialog__reply[hidden] {
  display: none;
}

.st-post-dialog__reply strong {
  color: var(--text);
}

.st-post-dialog__form {
  flex-shrink: 0;
  padding: 10px var(--space-3) var(--space-4);
  border-top: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  gap: 10px;
}

.st-post-dialog__field {
  flex: 1;
  min-width: 0;
  height: var(--tap-min);
  padding: 0 var(--space-4);
  border-radius: var(--radius-full);
  background: var(--surface-2);
  display: flex;
  align-items: center;
}

.st-post-dialog__field:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.st-post-dialog__field > input {
  flex: 1;
  min-width: 0;
  width: auto;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  outline: none;
  color: var(--text);
  font: inherit;
  font-size: var(--text-base);
}

.st-post-dialog__field > input:focus {
  background: transparent;
  box-shadow: none;
}

.st-post-dialog__field > input::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

@media (max-width: 1023px) {
  .st-post-dialog {
    height: min(620px, calc(100dvh - var(--space-10)));
  }

  #post-dialog.st-post-dialog--full {
    top: 0;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    border-width: 0;
  }

  #post-dialog.st-post-dialog--full .st-dialog__handle {
    display: none;
  }

  .st-post-dialog__form {
    padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
  }
}

/* ---------- Un commentaire ---------- */

.st-comment {
  padding: var(--space-1) var(--space-2) 0 var(--space-4);
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.st-comment__avatar,
.st-comment__name,
.st-comment__reply,
.st-comment__like {
  width: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  font: inherit;
  letter-spacing: 0;
  color: inherit;
  cursor: pointer;
}

.st-comment__avatar:hover,
.st-comment__name:hover,
.st-comment__reply:hover,
.st-comment__like:hover {
  filter: none;
  transform: none;
  box-shadow: none;
}

.st-comment__avatar {
  flex-shrink: 0;
  border-radius: var(--radius-full);
  display: flex;
}

.st-comment__avatar .st-avatar {
  --avatar-size: 34px;
}

.st-comment--reply .st-comment__avatar .st-avatar {
  --avatar-size: var(--avatar-sm);
}

.st-comment__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.st-comment__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.st-comment__name {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
}

.st-comment__name:hover {
  text-decoration: underline;
}

.st-comment__time {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.st-comment__text {
  margin: 0;
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  overflow-wrap: anywhere;
}

.st-comment__actions {
  margin-left: calc(var(--space-2) * -1);
  display: flex;
}

.st-comment__reply {
  min-height: var(--tap-min);
  padding: 0 var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-muted);
}

.st-comment__reply:hover {
  color: var(--text);
}

.st-comment__like {
  min-width: var(--tap-min);
  height: var(--tap-min);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  color: var(--text-muted);
}

.st-comment__like[aria-pressed="true"] {
  color: var(--like);
}

.st-comment__like[aria-pressed="true"] > svg {
  fill: currentColor;
}

/* Réponses : décalées sous le commentaire, avec un trait à gauche */
.st-comment__replies {
  margin-left: 32px;
  padding-left: 18px;
  border-left: 2px solid var(--hairline);
}

.st-comment__replies > .st-comment {
  padding-left: 0;
}

.st-comment--new {
  animation: st-comment-in var(--duration-base) var(--ease-out);
}

@keyframes st-comment-in {
  from { background: var(--accent-soft); }
}

.st-empty--compact {
  padding: var(--space-8) var(--space-6);
  font-size: var(--text-sm);
}

/* ---------- Envoyer (maquette Envoyer) ---------- */

.st-share {
  height: min(724px, calc(100dvh - var(--space-10)));
}

.st-share__search {
  flex-shrink: 0;
  margin: 0 var(--space-4) var(--space-2);
}

.st-share__list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 var(--space-2) var(--space-2);
}

.st-share__label {
  margin: 0;
  padding: var(--space-3) var(--space-2) var(--space-1);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.st-share__item,
.st-share__nexus {
  min-height: 60px;
}

.st-share__nexus > svg {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform var(--duration-fast) ease;
}

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

.st-share__channels {
  padding-left: var(--space-10);
}

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

.st-share__channel {
  min-height: var(--tap-min);
}

.st-share__hash {
  width: 24px;
  flex-shrink: 0;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-align: center;
}

/* Rond de sélection : vide, puis vert coché */
.st-share__check {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-full);
  color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}

.st-share__item[aria-checked="true"] {
  background: var(--selected);
}

.st-share__item[aria-checked="true"] .st-share__check {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

.st-share__foot {
  flex-shrink: 0;
  padding: var(--space-3) var(--space-4) var(--space-4);
  padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--hairline);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-2);
}

.st-share__foot > .st-btn {
  min-height: 48px;
}

.st-share__foot > .st-btn--primary {
  overflow: hidden;
  text-overflow: ellipsis;
}

.st-nexus-mark--lg {
  width: var(--avatar-md);
  height: var(--avatar-md);
  border-radius: var(--radius-md);
  font-size: var(--text-lg);
}
