/* ==========================================================================
   Stellion — créer une publication
   Maquettes : CreerPost (mobile, pleine page), BureauPublier (ordinateur, fenêtre).
   ========================================================================== */

.st-compose {
  height: min(720px, calc(100dvh - var(--space-8)));
}

.st-compose__head {
  padding: var(--space-2) var(--space-3) var(--space-2) var(--space-2);
  border-bottom: 1px solid var(--hairline);
}

.st-compose__title {
  text-align: center;
  font-size: var(--text-lg);
}

.st-compose__head .st-btn--primary {
  min-height: 38px;
  padding: 0 var(--space-4);
}

.st-compose__body {
  gap: var(--space-3);
  padding-top: var(--space-4);
}

.st-compose__main {
  display: flex;
  gap: var(--space-3);
}

.st-compose__me .st-avatar {
  --avatar-size: 42px;
}

.st-compose__fields {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.st-compose__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.st-compose__chip,
.st-compose__vis {
  min-height: 32px;
  padding: 0 var(--space-2) 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--accent-text);
}

.st-compose__vis {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

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

.st-compose__vis > select {
  width: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: inherit;
  font: inherit;
  outline: none;
  cursor: pointer;
}

.st-compose__text {
  width: 100%;
  min-height: 120px;
  margin: 0;
  padding: var(--space-1) 0 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  outline: none;
  color: var(--text);
  font: inherit;
  font-size: var(--text-lg);
  line-height: var(--leading-normal);
  resize: none;
}

.st-compose__text:focus {
  background: transparent;
  box-shadow: none;
}

.st-compose__text::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

/* Vignettes des photos et vidéos ajoutées */
.st-compose__previews {
  padding-left: 54px;
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
}

.st-compose__previews:empty {
  display: none;
}

.st-compose__thumb {
  position: relative;
  width: 104px;
  height: 132px;
  flex-shrink: 0;
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  overflow: hidden;
}

.st-compose__thumb > img,
.st-compose__thumb > video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.st-compose__remove {
  position: absolute;
  top: 0;
  right: 0;
  width: var(--tap-min);
  height: var(--tap-min);
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

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

.st-compose__remove > span {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  background: var(--media-scrim);
  color: var(--on-media);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Sections dépliables : sondage, destinations, musique */
.st-compose__section {
  padding-top: var(--space-3);
  border-top: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.st-compose__section[hidden],
.st-compose__dest[hidden],
#poll-add-btn[hidden] {
  display: none;
}

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

.st-compose__poll,
.st-compose__dests {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.st-compose__poll-row,
.st-compose__dest {
  display: flex;
  align-items: center;
  gap: 6px;
}

.st-compose__dest > .st-check {
  flex: 1;
  min-width: 0;
  color: var(--text);
}

.st-compose__dest > select {
  width: auto;
  max-width: 50%;
}

#poll-add-btn {
  align-self: flex-start;
}

.st-compose__music-results {
  max-height: 180px;
  overflow-y: auto;
}

/* Outils en bas : photo, sondage, musique */
.st-compose__tools {
  flex-shrink: 0;
  padding: var(--space-2) var(--space-3) calc(var(--space-2) + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.st-compose__tools > .st-icon-btn[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent-text);
}

.st-compose__hint {
  margin-left: auto;
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-align: right;
}

/* Mobile : pleine page, comme la maquette */
@media (max-width: 1023px) {
  #modal-create-post {
    top: 0;
    height: 100dvh;
    max-height: 100dvh;
    border-width: 0;
    border-radius: 0;
    padding-top: env(safe-area-inset-top, 0px);
  }

  #modal-create-post .st-compose__hint {
    display: none;
  }
}
