/* Card actions: heart, views, ⋮ menu, collapsed card, report dialog (post_actions.js). */

/* ---- heart: outline, filled and red when saved ---- */
.post-like {
  align-items: center;
  background: none;
  border: 0;
  border-radius: var(--mx-radius-full, 999px);
  color: var(--mx-muted, #5b6472);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: var(--mx-font-size-small, 0.8rem);
  gap: 0.25rem;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0 0.5rem;
  white-space: nowrap;
}

.post-like-icon {
  fill: none;
  flex: none;
  height: 22px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  width: 22px;
}

.post-like[aria-pressed="true"] .post-like-icon {
  fill: currentColor;
}

.post-like-count[hidden] {
  display: none;
}

/* Post page: same look as the neighbouring «Поделиться» (.mx-btn.mx-btn-sm). */
.post-like.post-like--labelled {
  background: var(--mx-surface);
  border: 1px solid var(--mx-line, #e5e7eb);
  border-radius: var(--mx-radius-md, 12px);
  color: var(--mx-ink, #000);
  font-size: 0.875rem;
  font-weight: 600;
  gap: 0.4rem;
  padding: 0 0.6rem;
}

.post-like[aria-pressed="true"],
.post-like.post-like--labelled[aria-pressed="true"] {
  color: var(--mx-danger, #dc2626);
}

.post-like.post-like--labelled[aria-pressed="true"] {
  border-color: currentColor;
}

/* Pressed colour wins in every state; unpressed hover never looks pressed. */
.post-like[aria-pressed="true"],
.post-like[aria-pressed="true"]:is(:hover, :focus, :focus-visible, :active) {
  color: var(--mx-danger, #dc2626);
}

.post-like[aria-pressed="true"] .post-like-icon {
  fill: var(--mx-danger, #dc2626);
  stroke: var(--mx-danger, #dc2626);
}

.post-like:not([aria-pressed="true"]):is(:hover, :focus, :active) .post-like-icon {
  fill: none;
}

.post-like[hidden],
.post-menu-btn[hidden],
.post-views[hidden],
.feed-card-follow-btn[hidden] {
  display: none;
}

/* «Подписаться» on a card: quiet chip, 32px look, 44px touch area. */
.feed-card-header .feed-card-follow-btn {
  background: var(--mx-surface-soft, #f3f4f6);
  border-color: transparent;
  border-radius: var(--mx-radius-full, 999px);
  color: var(--mx-ink, #000);
  font-size: 0.8125rem;
  font-weight: 600;
  min-height: 32px;
  padding: 0 0.6rem;
  position: relative;
}

.feed-card-header .feed-card-follow-btn::after {
  content: "";
  inset: -6px -4px;
  position: absolute;
}

.feed-card-header .feed-card-follow-btn[aria-pressed="true"] {
  background: transparent;
  color: var(--mx-muted, #5b6472);
  font-weight: 500;
}

/* Card footer: «👁 128 · 2 часа назад» on one line. */
.feed-card-footer-meta .post-views {
  font-size: 0.9375rem;
  font-weight: 400;
  white-space: nowrap;
}

.feed-card-footer-meta .post-views::after {
  content: "·";
  margin-left: 0.5rem;
}

/* ---- views ---- */
.post-views {
  align-items: center;
  color: var(--mx-muted, #5b6472);
  display: inline-flex;
  font-size: var(--mx-font-size-small, 0.8rem);
  gap: 0.25rem;
}

.post-views svg {
  fill: none;
  flex: none;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.8;
  width: 16px;
}

/* ---- ⋮ button: 44px hit area, about 28px circle ---- */
.post-menu-btn {
  align-items: center;
  background: none;
  border: 0;
  color: var(--mx-muted, #5b6472);
  cursor: pointer;
  display: inline-flex;
  flex: none;
  height: 44px;
  justify-content: center;
  padding: 0;
  position: relative;
  width: 44px;
}

.post-menu-btn::before {
  border-radius: 50%;
  content: "";
  height: 28px;
  position: absolute;
  width: 28px;
}

.post-menu-btn:hover::before,
.post-menu-btn[aria-expanded="true"]::before {
  background: var(--mx-surface-soft, #f8fafc);
}

/* Over a picture: a round surface behind the dots. */
.post-menu-btn--surface {
  color: var(--mx-ink, #000);
}

.post-menu-btn--surface::before {
  background: var(--mx-surface, #fff);
  box-shadow: var(--mx-shadow-sm, 0 1px 4px rgba(0, 0, 0, 0.07));
}

.post-menu-btn svg {
  fill: currentColor;
  height: 18px;
  position: relative;
  width: 18px;
}

/* ---- popover ---- */
.post-menu {
  background: var(--mx-surface, #fff);
  border: 1px solid var(--mx-line, #e5e7eb);
  border-radius: var(--mx-radius-md, 10px);
  box-shadow: var(--mx-shadow-xl, 0 10px 30px rgba(0, 0, 0, 0.13));
  box-sizing: border-box;
  max-height: calc(100vh - 16px);
  max-width: calc(100vw - 16px);
  min-width: min(240px, calc(100vw - 16px));
  overflow-y: auto;
  padding: 0.25rem 0;
  position: fixed;
  z-index: 70;
}

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

.post-menu-item {
  background: none;
  border: 0;
  color: var(--mx-ink, #000);
  cursor: pointer;
  display: block;
  font: inherit;
  font-size: var(--mx-font-size-body, 1rem);
  min-height: 44px;
  padding: 0.5rem 1rem;
  text-align: left;
  width: 100%;
}

.post-menu-item:hover,
.post-menu-item:focus-visible {
  background: var(--mx-surface-soft, #f8fafc);
}

.post-menu-sep {
  border-top: 1px solid var(--mx-line, #e5e7eb);
  margin: 0.25rem 0;
}

/* ---- report dialog: pinned to the top so a phone keyboard does not cover it ---- */
.post-menu--form {
  left: 50%;
  padding: 1rem;
  top: 8px;
  transform: translateX(-50%);
  width: min(360px, calc(100vw - 16px));
}

.post-report-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.post-report-text {
  border: 1px solid var(--mx-line, #e5e7eb);
  border-radius: var(--mx-radius-sm, 6px);
  box-sizing: border-box;
  font: inherit;
  font-size: var(--mx-font-size-body, 1rem);
  padding: 0.5rem;
  resize: vertical;
  width: 100%;
}

.post-report-error {
  color: var(--mx-accent-strong, #e21c23);
  margin: 0.5rem 0 0;
}

.post-report-error[hidden] {
  display: none;
}

.post-report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.post-report-send,
.post-report-cancel {
  border-radius: var(--mx-radius-md, 10px);
  cursor: pointer;
  font: inherit;
  font-size: var(--mx-font-size-body, 1rem);
  min-height: 44px;
  padding: 0 1rem;
}

.post-report-send {
  background: var(--mx-ink, #000);
  border: 1px solid var(--mx-ink, #000);
  color: var(--mx-surface, #fff);
}

.post-report-send:disabled {
  opacity: 0.6;
}

.post-report-cancel {
  background: var(--mx-surface, #fff);
  border: 1px solid var(--mx-line, #e5e7eb);
  color: var(--mx-ink, #000);
}

/* ---- collapsed card ---- */
.is-collapsed > *:not(.post-collapsed) {
  display: none !important;
}

.post-collapsed {
  align-items: center;
  color: var(--mx-muted, #5b6472);
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  justify-content: space-between;
  padding: 0.25rem 0.75rem;
}

.post-collapsed-btn {
  background: none;
  border: 0;
  color: var(--mx-accent, #0088cc);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  min-height: 44px;
  padding: 0 0.5rem;
}

/* ---- rules notice (428) ---- */
.post-rules-notice {
  background: #fff7e0;
  border: 1px solid #e6c36a;
  border-radius: var(--mx-radius-md, 10px);
  bottom: 1rem;
  box-sizing: border-box;
  left: 1rem;
  padding: 0.75rem 1rem;
  position: fixed;
  right: 1rem;
  z-index: 80;
}

@media (prefers-reduced-motion: no-preference) {
  .post-like-icon {
    transition: fill 0.15s ease;
  }
}

.post-rules-notice-close {
  background: none;
  border: 1px solid currentColor;
  border-radius: var(--mx-radius-md, 10px);
  color: inherit;
  cursor: pointer;
  display: block;
  font: inherit;
  margin-top: 0.5rem;
  min-height: 44px;
  padding: 0 1rem;
}

/* Одно сообщение внизу экрана над нижней панелью; следующее заменяет предыдущее. */
.post-toast {
  background: #222;
  border-radius: var(--mx-radius-md, 10px);
  bottom: calc(var(--mx-tabbar-h, 0px) + env(safe-area-inset-bottom, 0px) + 0.75rem);
  box-sizing: border-box;
  color: #fff;
  font-size: 16px;
  left: 0.5rem;
  line-height: 1.4;
  max-width: 28rem;
  overflow-wrap: anywhere;
  padding: 0.75rem 1rem;
  pointer-events: none;
  position: fixed;
  right: 0.5rem;
  z-index: 1001; /* above the back-to-top button (1000), below dialogs (10000) */
}

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

@media (min-width: 981px) {
  .post-toast {
    left: 1rem;
    right: auto;
  }
}
