/**
 * Post Media-Grid & Aktionsleiste — Polish v2 (UI only)
 *
 * Gilt fuer Home-Feed UND Post-Detailansicht (beide rendern dieselben
 * Templates: ImagePost.php / textPost.php / post_audios.php), daher bewusst
 * OHNE Abhaengigkeit von body.sf-app-body oder .sf-feed als Vorbedingung.
 * Nutzt die globalen Design-Tokens aus tokens.css (--sf-*).
 */

/* ------------------------------------------------------------------ */
/* Media-Grid: 2er side-by-side, 3+ hero+tiles — kill legacy           */
/* width:50% / padding-top letterboxing from style.css                 */
/* ------------------------------------------------------------------ */

.i_image_one,
.i_image_two,
.i_image_three,
.i_image_four,
.i_image_five,
.i_image_gallery {
  display: grid !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  gap: 2px !important;
  margin: 0.45rem 0 0 !important;
  border-radius: var(--sf-radius-md, 14px);
  overflow: hidden;
  background: var(--sf-bg-page, #150a16);
  float: none !important;
}

.i_image_one {
  grid-template-columns: minmax(0, 1fr) !important;
}

.i_image_two {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

.i_image_three,
.i_image_four,
.i_image_five {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

.i_image_gallery {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, 1fr);
  height: 340px;
  max-height: 60vh;
}

.i_image_one .i_post_image_swip_wrapper,
.i_image_two .i_post_image_swip_wrapper,
.i_image_three .i_post_image_swip_wrapper,
.i_image_four .i_post_image_swip_wrapper,
.i_image_five .i_post_image_swip_wrapper,
.i_image_gallery .i_post_image_swip_wrapper {
  position: relative !important;
  overflow: hidden !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  margin-left: 0 !important;
  padding-top: 0 !important;
  float: none !important;
  min-height: 0 !important;
  background-color: var(--sf-bg-elevated, #221325);
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
}

.i_image_one .i_post_image_swip_wrapper {
  aspect-ratio: 4 / 5;
  max-height: min(70vh, 560px);
}

.i_image_two .i_post_image_swip_wrapper {
  aspect-ratio: 3 / 4;
  max-height: min(52vh, 440px);
}

.i_image_three .i_post_image_swip_wrapper,
.i_image_four .i_post_image_swip_wrapper,
.i_image_five .i_post_image_swip_wrapper {
  aspect-ratio: 1 / 1;
  max-height: min(46vh, 360px);
}

.i_image_gallery .i_post_image_swip_wrapper {
  aspect-ratio: unset;
  max-height: none;
  height: 100%;
}

.i_image_gallery .i_post_image_swip_wrapper:nth-child(1) {
  grid-column: 1 / 3;
  grid-row: 1 / 3;
}

.i_image_gallery .i_post_image_swip_wrapper:nth-child(2) {
  grid-column: 3;
  grid-row: 1;
}

.i_image_gallery .i_post_image_swip_wrapper:nth-child(3) {
  grid-column: 3;
  grid-row: 2;
}

.i_image_one .i_post_image_swip_wrapper .i_p_image,
.i_image_two .i_post_image_swip_wrapper .i_p_image,
.i_image_three .i_post_image_swip_wrapper .i_p_image,
.i_image_four .i_post_image_swip_wrapper .i_p_image,
.i_image_five .i_post_image_swip_wrapper .i_p_image,
.i_image_gallery .i_post_image_swip_wrapper .i_p_image {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  /* Legacy keeps img invisible; background-image is the visible tile */
  opacity: 0 !important;
}

.sf-media-more-badge {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--sf-font-family);
  font-size: var(--sf-font-size-xl, 1.375rem);
  font-weight: var(--sf-font-weight-semibold, 600);
  color: var(--sf-text-primary, #f7eef8);
  background: rgba(21, 10, 22, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  pointer-events: none;
  z-index: 2;
}

/* ------------------------------------------------------------------ */
/* Aktionsleiste: 4 gleich verteilte Aktionen statt fixer 20%-Breite   */
/* (Anzahl variiert je nach Post: 3 ohne Trinkgeld, 4 mit Trinkgeld)   */
/* ------------------------------------------------------------------ */

.sf-post-footer.i_post_footer,
body.sf-app-body .sf-feed .sf-post-footer.i_post_footer {
  flex-wrap: nowrap;
  justify-content: flex-start;
  gap: 0.35rem;
  padding: 0.55rem 0.85rem 0.65rem;
}

.sf-post-footer .i_post_footer_item,
body.sf-app-body .sf-feed .sf-post-footer .i_post_footer_item {
  width: auto;
  flex: 0 0 auto;
  min-width: 0;
  gap: 0.3rem;
}

/* Kommentar-Zaehler nutzt dieselbe Badge-Optik wie der Like-Zaehler */
.sf-post-footer .lp_sum {
  font-family: var(--sf-font-family);
  color: var(--sf-text-secondary, #c4b3c6);
  font-size: var(--sf-font-size-sm, 0.875rem);
}

/* Trinkgeld: eigene, farblich hervorgehobene Aktion (Gold/Coin-Farbe) */
.sf-post-footer .i_post_footer_item--tip .i_post_item_btn.in_tips {
  background: linear-gradient(135deg, rgba(212, 168, 83, 0.22), rgba(212, 168, 83, 0.08));
  border: 0.5px solid rgba(212, 168, 83, 0.45);
  border-radius: var(--sf-radius-full, 9999px);
  padding: 8px 14px;
}

.sf-post-footer .i_post_footer_item--tip .i_post_item_btn.in_tips svg {
  fill: var(--sf-color-gold, #d4a853) !important;
}

.sf-post-footer .i_post_footer_item--tip .i_post_item_btn.in_tips:hover {
  background: linear-gradient(135deg, rgba(212, 168, 83, 0.32), rgba(212, 168, 83, 0.14));
}

/* ------------------------------------------------------------------ */
/* Kontextmenue: verschobene Aktionen (Weiterteilen, Speichern) nutzen */
/* die bestehende .i_post_menu_item_out-Optik, keine weiteren Regeln   */
/* noetig. Nur die verschobene Speichern-Beschriftung ausrichten:      */
/* ------------------------------------------------------------------ */

.i_post_menu_item_out.svp {
  cursor: pointer;
}

.i_post_menu_item_out.svp span.in_save {
  display: inline-flex;
  align-items: center;
}

.i_post_menu_item_out.svp span.in_save svg {
  width: 18px;
  height: 18px;
  fill: inherit;
  margin-right: 8px;
}
