/**
 * Posts subsystem — единый дизайн.
 * Используется на:
 *   - /feed/                         (posts/feed.php)
 *   - /@username (таб «Посты»)        (profilePage.php)
 *   - /posts/{id}/                   (posts/view.php)
 *   - /posts/postPublication         (форма создания/редактирования)
 *
 * Все цвета — через CSS-переменные из assets/css/style.css (`--color-primary`).
 * Один namespace `post-*`, никаких локальных дубликатов в страницах.
 */

:root {
    --post-radius: 14px;
    --post-radius-sm: 10px;
    --post-bg: #ffffff;
    --post-border: #e2e5ee;
    --post-border-hover: #cbd5e1;
    --post-text: #0b1220;
    --post-text-muted: #475569;
    --post-text-dim: #94a3b8;
    --post-surface-soft: #f8faff;
    --post-surface-hint: #f3f6ff;
    --post-locked-blur: 22px;
    --post-locked-bg: #1a2233;
    --post-cta-accent: #ff6b35;
    --post-cta-accent--hover: #f05a25;
    --post-shadow: 0 8px 24px rgba(15, 23, 42, .04);
}

/* ═══════════════════════════════════════════════════════════════
   PAGE LAYOUT (один контейнер для всех страниц постов)
   ═══════════════════════════════════════════════════════════════ */
.post-page {
    max-width: 760px;
    margin: 24px auto 60px;
    padding: 0 16px;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--post-text);
}
.post-page--wide { max-width: 1180px; }

/* ═══════════════════════════════════════════════════════════════
   FEED HERO + NAV CRUMBS
   ═══════════════════════════════════════════════════════════════ */
/* Акцентный заголовок ленты. Цветной icon-tile + градиентная подложка
   справа делают страницу узнаваемой и снимают «голый» вид. */
.post-feed-hero {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    margin-bottom: 14px;
    border-radius: 18px;
    overflow: hidden;
    color: var(--post-text);
    background:
        linear-gradient(135deg, rgba(10, 67, 255, .07) 0%, rgba(255, 107, 53, .06) 100%),
        var(--post-bg);
    border: 1px solid var(--post-border);
}
.post-feed-hero::after {
    /* Декоративная подсветка справа — чисто визуальный акцент. */
    content: '';
    position: absolute;
    right: -60px;
    top: -40px;
    width: 220px;
    height: 220px;
    background: radial-gradient(closest-side, rgba(10, 67, 255, .18), transparent 70%);
    pointer-events: none;
}
.post-feed-hero__icon {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
    background: linear-gradient(135deg, var(--color-primary, #0a43ff) 0%, #6a35ff 100%);
    box-shadow: 0 6px 18px rgba(10, 67, 255, .28);
    position: relative;
    z-index: 1;
}
.post-feed-hero__main { min-width: 0; flex: 1; position: relative; z-index: 1; }
.post-feed-hero__title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -.01em;
}
.post-feed-hero__sub {
    margin-top: 4px;
    color: var(--post-text-muted);
    font-size: 13.5px;
    line-height: 1.45;
}
@media (max-width: 600px) {
    .post-feed-hero { padding: 14px 14px; gap: 12px; border-radius: 14px; margin-bottom: 10px; }
    .post-feed-hero__icon { width: 40px; height: 40px; font-size: 17px; border-radius: 12px; }
    .post-feed-hero__title { font-size: 18px; }
    .post-feed-hero__sub { font-size: 12.5px; }
}

/* Chips-крошки в ленте используют общие классы `.category-chips-scroll`
   из каталога — единый паттерн навигации. Здесь только локальный отступ. */
.post-feed-crumbs { margin-bottom: 14px; }

/* Последний chip-крошка (текущая страница) — обрезаем длинный title
   ellipsis'ом, чтобы он не растягивал scroll-row. */
.post-feed-crumbs__current {
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: default;
}
@media (max-width: 480px) {
    .post-feed-crumbs__current { max-width: 180px; }
}

/* ═══════════════════════════════════════════════════════════════
   FEED LIST + TABS
   ═══════════════════════════════════════════════════════════════ */
.post-feed {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.post-feed__empty,
.post-feed__loading {
    text-align: center;
    padding: 48px 16px;
    color: var(--post-text-dim);
    font-size: 14px;
}
.post-feed__empty-big {
    font-size: 18px;
    color: var(--post-text-muted);
    margin-bottom: 6px;
    font-weight: 500;
}
.post-feed__loadmore {
    text-align: center;
    padding: 18px;
}
.post-feed__loadmore button {
    padding: 9px 22px;
    border-radius: 999px;
    background: var(--post-bg);
    border: 1px solid var(--post-border);
    cursor: pointer;
    font-size: 14px;
    color: var(--post-text);
    transition: border-color .15s ease, background-color .15s ease;
}
.post-feed__loadmore button:hover {
    border-color: var(--post-border-hover);
    background: var(--post-surface-soft);
}

.post-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: #f1f5f9;
    border-radius: 999px;
    margin-bottom: 16px;
    width: fit-content;
}
.post-tab {
    padding: 8px 18px;
    border-radius: 999px;
    cursor: pointer;
    user-select: none;
    font-size: 14px;
    font-weight: 500;
    color: var(--post-text-muted);
    text-decoration: none;
    transition: color .15s ease;
}
.post-tab:hover { color: var(--post-text); }
.post-tab.is-active {
    background: var(--post-bg);
    color: var(--color-primary, #0a43ff);
    box-shadow: 0 1px 3px rgba(15, 23, 42, .06);
}

/* ═══════════════════════════════════════════════════════════════
   POST CARD (используется в любой ленте)
   ═══════════════════════════════════════════════════════════════ */
.post-card {
    position: relative;
    background: var(--post-bg);
    border: 1px solid var(--post-border);
    border-radius: var(--post-radius);
    padding: 14px 16px;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.post-card:hover {
    border-color: var(--post-border-hover);
    box-shadow: 0 10px 24px rgba(15, 23, 42, .07);
    transform: translateY(-1px);
}

/* Author block (used in card + view) */
.post-author {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.post-author__avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: #e2e8f0;
}
.post-author__name {
    font-weight: 600;
    font-size: 14px;
    line-height: 1.2;
}
.post-author__name a { color: var(--post-text); text-decoration: none; }
.post-author__name a:hover { color: var(--color-primary, #0a43ff); }
.post-author__date { font-size: 12px; color: var(--post-text-dim); }
.post-author__name .verified-badge-wrap { margin-left: 4px; vertical-align: middle; }

/* Badges */
.post-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}
.post-badge {
    padding: 2px 9px;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    font-weight: 500;
    font-size: 11px;
}
.post-badge--paid    { background: #fef3c7; color: #92400e; }
.post-badge--locked  { background: #f1f5f9; color: #475569; }
.post-badge--draft   { background: #fee2e2; color: #991b1b; }

/* Card body */
.post-card__title {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
    margin: 0 0 6px;
}
.post-card__title a { color: var(--post-text); text-decoration: none; }
.post-card__title a:hover { color: var(--color-primary, #0a43ff); }

.post-card__excerpt {
    color: var(--post-text-muted);
    font-size: 14px;
    line-height: 1.5;
    margin: 0 0 10px;
}
/* Inline-кнопка/ссылка «Читать далее» внутри обычного excerpt-текста */
.post-card__excerpt > .post-card__more {
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    color: var(--color-primary, #0a43ff);
    font-weight: 600;
    font-size: inherit;
    white-space: nowrap;
}
.post-card__excerpt > .post-card__more:hover { text-decoration: underline; }

/* ── Collapsible body с fade-эффектом ───────────────────────────────
   Тело поста рендерится целиком, но визуально режется через max-height +
   градиент к фону карточки. Кнопка «Читать далее» лежит поверх fade. */
.post-card__excerpt--collapsible {
    position: relative;
    margin: 0 0 10px;
}
.post-card__excerpt--collapsible .post-card__body {
    color: var(--post-text);
    font-size: 15px;
    line-height: 1.6;
    overflow: hidden;
    transition: max-height .3s ease;
}
.post-card__excerpt--collapsible[data-expanded="false"] .post-card__body {
    max-height: 220px;
}
.post-card__excerpt--collapsible[data-expanded="true"] .post-card__body {
    max-height: none;
}
.post-card__excerpt--collapsible .post-card__body p { margin: 0 0 10px; }
.post-card__excerpt--collapsible .post-card__body p:last-child { margin-bottom: 0; }
.post-card__excerpt--collapsible .post-card__body a {
    color: var(--color-primary, #0a43ff);
    text-decoration: underline;
}

.post-card__fade {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 32px;
    height: 96px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, var(--post-bg) 85%);
    pointer-events: none;
    transition: opacity .25s ease;
}
.post-card__excerpt--collapsible[data-expanded="true"] .post-card__fade {
    opacity: 0;
}

.post-card__excerpt--collapsible .post-card__more {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    background: none;
    border: 0;
    padding: 6px 0;
    margin-top: 6px;
    cursor: pointer;
    color: var(--color-primary, #0a43ff);
    font-weight: 600;
    font-size: 14px;
}
.post-card__excerpt--collapsible .post-card__more:hover {
    color: var(--color-primary--hover, #0830c2);
}

.post-card__cover {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: var(--post-radius-sm);
    margin: 8px 0 10px;
    display: block;
    background: #f1f5f9;
}

/* Author meta — дата + просмотры рядом с username */
.post-author__main { flex: 1; min-width: 0; }
.post-author__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--post-text-dim);
    margin-top: 1px;
}
.post-author__meta-dot {
    width: 3px; height: 3px;
    border-radius: 50%;
    background: currentColor;
    opacity: .7;
    flex-shrink: 0;
}
.post-author__meta-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.post-author__meta-item i { font-size: 11px; }

/* Action bar (footer карточки + footer view-страницы) */
.post-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    padding-top: 10px;
    margin-top: 12px;
    border-top: 1px solid #f1f5f9;
}
.post-actions--right {
    margin-left: auto;
    padding-top: 0;
    margin-top: 0;
    border-top: 0;
}
.post-action-btn {
    border: none;
    background: transparent;
    padding: 6px 10px;
    border-radius: 999px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #64748b;
    font-size: 13px;
    text-decoration: none;
    transition: background-color .15s ease, color .15s ease;
    font-family: inherit;
    line-height: 1;
}
.post-action-btn:hover {
    background: #f1f5f9;
    color: var(--post-text);
}
.post-action-btn:active { transform: scale(.96); }
.post-action-btn i { font-size: 15px; }
.post-action-btn[disabled] { opacity: .5; cursor: not-allowed; }
.post-action-btn--like[data-liked="true"] { color: #dc2626; }
.post-action-btn--like[data-liked="true"]:hover { background: #fef2f2; }
.post-action-btn--donate { color: #ea580c; }
.post-action-btn--donate:hover { background: #fff7ed; }
.post-action-btn--menu { padding: 6px 9px; }

/* Author wrapper — ellipsis-меню справа */
.post-author--with-menu { align-items: flex-start; }

/* Kebab dropdown menu (Edit / Delete / Report) */
.post-menu { position: relative; }
.post-menu__dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 200px;
    background: var(--post-bg);
    border: 1px solid var(--post-border);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, .12), 0 2px 8px rgba(15, 23, 42, .06);
    padding: 6px;
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 2px;
    animation: post-menu-in .15s ease;
}
@keyframes post-menu-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.post-menu__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border: 0;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    color: var(--post-text);
    text-decoration: none;
    text-align: left;
    width: 100%;
    line-height: 1.2;
    transition: background-color .12s ease, color .12s ease;
}
.post-menu__item:hover { background: var(--post-surface-soft); }
.post-menu__item i {
    width: 16px;
    text-align: center;
    color: var(--post-text-muted);
    font-size: 14px;
    flex-shrink: 0;
}
.post-menu__item--danger { color: #dc2626; }
.post-menu__item--danger i { color: #dc2626; }
.post-menu__item--danger:hover { background: #fef2f2; }

/* ═══════════════════════════════════════════════════════════════
   LOCKED PREVIEW (Boosty-style) — общий для card + view
   ═══════════════════════════════════════════════════════════════ */
.post-locked {
    /* Когда .post-locked рендерится как <a>, нужно явно block,
       иначе inline-default ломает width/aspect-ratio/abs.children. */
    display: block;
    position: relative;
    border-radius: var(--post-radius-sm);
    overflow: hidden;
    background: var(--post-locked-bg);
    aspect-ratio: 16 / 9;
    margin: 8px 0 10px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}
.post-locked:hover { text-decoration: none; color: inherit; }
.post-locked--lg {
    aspect-ratio: auto;
    min-height: 380px;
    border-radius: 16px;
    margin: 18px 0;
}
.post-locked__bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(var(--post-locked-blur)) brightness(0.65) saturate(1.1);
    transform: scale(1.18);
}
.post-locked__bg-fallback {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 30% 20%, rgba(10, 67, 255, .40), transparent 55%),
        radial-gradient(circle at 70% 80%, rgba(220, 38, 38, .28), transparent 55%),
        linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}
.post-locked__overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(0, 0, 0, .10) 0%, rgba(0, 0, 0, .25) 60%, rgba(0, 0, 0, .55) 100%);
    color: #fff;
    padding: 20px;
}
/* Для card-варианта — overlay компактнее, по центру */
.post-locked .post-locked__overlay {
    align-items: center;
}
.post-locked--lg .post-locked__overlay {
    align-items: center;
    padding: 28px 20px;
}
/* ── Унифицированный locked notice ─────────────────────────────────
   Pill в стиле дизайн-системы (border-radius: 999px, как .post-cta).
   Горизонтальная компоновка: [icon] · [main] · [hint].
   Контент меняется по data-reason; различается только hover-tint. */
.post-locked__notice {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 9px 18px;
    background: rgba(15, 23, 42, .55);
    -webkit-backdrop-filter: blur(10px) saturate(1.2);
    backdrop-filter: blur(10px) saturate(1.2);
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .14);
    color: #fff;
    font-size: 13px;
    text-shadow: 0 1px 4px rgba(0, 0, 0, .35);
    transition: transform .18s ease, background-color .18s ease, border-color .18s ease;
    max-width: calc(100% - 32px);
    line-height: 1.2;
}
.post-locked:hover .post-locked__notice { transform: scale(1.03); }
.post-locked[data-reason="paywall"]:hover .post-locked__notice,
.post-locked[data-reason="tier_or_paid_locked"]:hover .post-locked__notice {
    background: rgba(255, 107, 53, .60);
    border-color: rgba(255, 255, 255, .25);
}
.post-locked[data-reason="subscriber_only"]:hover .post-locked__notice,
.post-locked[data-reason="tier_locked"]:hover .post-locked__notice {
    background: rgba(10, 67, 255, .60);
    border-color: rgba(255, 255, 255, .25);
}
.post-locked__notice-icon {
    font-size: 13px;
    opacity: .85;
    flex-shrink: 0;
}
.post-locked__notice-main {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -.01em;
    display: inline-flex;
    align-items: baseline;
    gap: 2px;
    white-space: nowrap;
}
.post-locked__notice-currency {
    font-size: 13px;
    font-weight: 600;
    opacity: .85;
}
.post-locked__notice-hint {
    font-size: 12px;
    opacity: .75;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* CSS-точка-разделитель перед подсказкой */
}
.post-locked__notice-hint::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: currentColor;
    margin: 0 8px 2px 0;
    vertical-align: middle;
    opacity: .55;
}

/* --lg на view.php — чуть крупнее, та же pill-форма */
.post-locked--lg .post-locked__notice {
    padding: 11px 22px;
    gap: 12px;
    font-size: 14px;
}
.post-locked--lg .post-locked__notice-icon { font-size: 14px; }
.post-locked--lg .post-locked__notice-main { font-size: 20px; }
.post-locked--lg .post-locked__notice-currency { font-size: 15px; }
.post-locked--lg .post-locked__notice-hint { font-size: 13px; }
.post-locked__icon {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(15, 23, 42, .55);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
}
.post-locked--lg .post-locked__icon {
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    font-size: 14px;
}

/* ═══════════════════════════════════════════════════════════════
   CTA BUTTONS (общий стиль для всех CTA постов)
   ═══════════════════════════════════════════════════════════════ */
.post-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background-color .15s ease, transform .08s ease, border-color .15s ease;
    background: var(--color-primary, #0a43ff);
    color: #fff;
}
.post-cta:hover { background: var(--color-primary--hover, #0830c2); }
.post-cta:active { transform: scale(.97); }
.post-cta:disabled,
.post-cta[disabled] { opacity: .55; cursor: progress; }

.post-cta--accent { background: var(--post-cta-accent); }
.post-cta--accent:hover { background: var(--post-cta-accent--hover); }

.post-cta--secondary {
    background: var(--post-bg);
    color: var(--post-text);
    border-color: var(--post-border);
}
.post-cta--secondary:hover {
    background: var(--post-surface-soft);
    border-color: var(--post-border-hover);
}

.post-cta--lg {
    padding: 12px 28px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.post-cta--ghost {
    background: transparent;
    color: var(--post-text);
    border-color: var(--post-border);
}
.post-cta--ghost:hover {
    background: var(--post-surface-soft);
}

.post-cta--danger {
    background: transparent;
    color: #dc2626;
    border-color: #fecaca;
}
.post-cta--danger:hover {
    background: #fef2f2;
}

/* ═══════════════════════════════════════════════════════════════
   SINGLE POST VIEW (posts/view.php)
   ═══════════════════════════════════════════════════════════════ */
.post-view {
    background: var(--post-bg);
    border: 1px solid var(--post-border);
    border-radius: 18px;
    box-shadow: var(--post-shadow);
    padding: 22px 22px 18px;
}
.post-view__author { margin-bottom: 14px; }
.post-view__author .post-author__avatar { width: 44px; height: 44px; }
.post-view__author .post-author__name { font-size: 15px; }

.post-view__cover {
    margin: 14px -22px;
    overflow: hidden;
}
.post-view__cover img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
    background: #f1f5f9;
}
.post-view__title {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.25;
    margin: 8px 0 12px;
}
.post-view__body {
    font-size: 16px;
    line-height: 1.6;
    color: #1f2937;
}
.post-view__body p { margin: 0 0 12px; }
.post-view__body a { color: var(--color-primary, #0a43ff); }
.post-view__body img { max-width: 100%; border-radius: 8px; }
.post-view__body h2,
.post-view__body h3,
.post-view__body h4 { margin: 18px 0 8px; font-weight: 700; }

/* Smart-grid галерея в стиле Telegram. Layout управляется через [data-count]
   на родителе. Тайлы — равные квадраты внутри сетки, фото обрезаются под
   контейнер через object-fit. Для 5+ фото — 2×2 + overlay «+N» на 4-ом.
   Aspect-ratio выбран так, чтобы галерея не съедала пол-экрана: даже при
   широкой странице высота ≤ 60% width. */
.post-view__media {
    display: grid;
    gap: 6px;
    margin: 16px 0;
    border-radius: var(--post-radius-sm);
    overflow: hidden;
}
.post-view__media-tile {
    position: relative;
    overflow: hidden;
    background: #f1f5f9;
    cursor: zoom-in;
    /* Тонкий inner-border — разделяет тайлы даже если у фото белый фон
       (типичная проблема логотипов / скриншотов на белом). */
    box-shadow: inset 0 0 0 1px rgba(15,23,42,0.06);
}
.post-view__media-tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.25s ease;
}
.post-view__media-tile:hover img { transform: scale(1.03); }

/* Высота — через фиксированные grid-rows: ширина гарантированно 100% от
   родителя (galaxy `aspect-ratio + max-height` сжимал ширину чтобы сохранить
   пропорции). object-fit:cover обрежет фото под тайл, полная картинка
   откроется в лайтбоксе. */
.post-view__media[data-count="1"] {
    grid-template-columns: 1fr;
    grid-template-rows: 380px;
}

.post-view__media[data-count="2"] {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 260px;
}

/* 3 фото: одно большое слева, два маленьких справа — общая высота 360. */
.post-view__media[data-count="3"] {
    grid-template-columns: 2fr 1fr;
    grid-template-rows: 180px 180px;
}
.post-view__media[data-count="3"] .post-view__media-tile:nth-child(1) {
    grid-row: span 2;
}

/* 4 фото: 2×2, total height 440 (две строки по 220). */
.post-view__media[data-count="4"] {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 220px 220px;
}

/* +N overlay на 4-ом тайле когда фото >4 */
.post-view__media-tile--more::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    pointer-events: none;
}
.post-view__media-more {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
    z-index: 1;
    pointer-events: none;
}

@media (max-width: 480px) {
    .post-view__media { gap: 4px; }
    .post-view__media[data-count="1"] { grid-template-rows: 240px; }
    .post-view__media[data-count="2"] { grid-template-rows: 160px; }
    .post-view__media[data-count="3"] { grid-template-rows: 120px 120px; }
    .post-view__media[data-count="4"] { grid-template-rows: 150px 150px; }
    .post-view__media-more { font-size: 26px; }
}

.post-view__files {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 18px 0 8px;
}
.post-file {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--post-surface-soft);
    border: 1px solid var(--post-border);
    border-radius: var(--post-radius-sm);
    text-decoration: none;
    color: var(--post-text);
    transition: background-color .15s ease;
}
.post-file:hover { background: #eef2ff; }
.post-file__icon {
    width: 32px; height: 32px;
    background: #eef2ff;
    color: #4338ca;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.post-file__name { font-weight: 500; font-size: 14px; }
.post-file__meta { font-size: 12px; color: #6b7280; }
.post-file__dl { margin-left: auto; font-size: 13px; color: var(--color-primary, #0a43ff); }

.post-view__products,
.post-card__products {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin: 12px 0;
}
.post-view__products { margin: 18px 0; }
.post-product {
    background: var(--post-surface-soft);
    border: 1px solid var(--post-border);
    border-radius: var(--post-radius-sm);
    padding: 10px;
    display: flex;
    gap: 10px;
    text-decoration: none;
    color: var(--post-text);
    transition: border-color .15s ease;
}
.post-product:hover { border-color: var(--color-primary, #0a43ff); }
.post-product img {
    width: 54px; height: 54px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: #e2e8f0;
}
.post-product__title { font-weight: 500; font-size: 14px; line-height: 1.3; }
.post-product__price { font-size: 13px; color: var(--color-primary, #0a43ff); margin-top: 4px; }

/* ===========================================================
   Phase 6 — post_products карточка с CTA «Купить»
   Используется в posts/view.php (full-mode).
   =========================================================== */
.post-view__products {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
}
.post-pp-card {
    background: var(--post-surface, #fff);
    border: 1px solid var(--post-border, #e5e7eb);
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}
.post-pp-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 6px 16px rgba(17, 24, 39, 0.08);
    transform: translateY(-1px);
}
.post-pp-card.is-purchased { border-color: #bbf7d0; }
.post-pp-card.is-purchased:hover { border-color: #86efac; }

.post-pp-card__cover {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    background: #f3f4f6;
    overflow: hidden;
}
.post-pp-card__cover img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}
.post-pp-card:hover .post-pp-card__cover img { transform: scale(1.03); }
.post-pp-card__cover-empty {
    width: 100%; height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #cbd5e1;
    font-size: 38px;
}
.post-pp-card__badge {
    position: absolute;
    top: 10px; right: 10px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    backdrop-filter: blur(8px);
}
.post-pp-card__badge--purchased {
    background: rgba(22, 163, 74, 0.92);
    color: #fff;
}
.post-pp-card__badge--purchased i { margin-right: 4px; }

.post-pp-card__body {
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}
.post-pp-card__title {
    color: var(--post-text, #111827);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.15s ease;
}
.post-pp-card__title:hover { color: var(--color-primary, #0a43ff); }

.post-pp-card__author {
    color: var(--post-text-muted, #6b7280);
    font-size: 12px;
    text-decoration: none;
    transition: color 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.post-pp-card__author:hover { color: var(--post-text, #111827); }

.post-pp-card__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: auto;
    padding-top: 8px;
}
.post-pp-card__price {
    font-size: 16px;
    font-weight: 700;
    color: var(--post-text, #111827);
    letter-spacing: -0.01em;
}
.post-pp-card__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px;
    padding: 0 14px;
    background: var(--color-primary, #0a43ff);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}
.post-pp-card__cta:hover {
    background: #0735c4;
    color: #fff;
    transform: translateY(-1px);
}
.post-pp-card__cta--ghost {
    background: transparent;
    color: var(--post-text, #111827);
    border: 1px solid var(--post-border-strong, #d1d5db);
}
.post-pp-card__cta--ghost:hover {
    background: #f9fafb;
    color: var(--post-text, #111827);
}

@media (max-width: 540px) {
    .post-view__products { grid-template-columns: 1fr; gap: 12px; }
    .post-pp-card__cover { aspect-ratio: 21 / 9; }
}

.post-view__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 14px 0;
}
.post-tag {
    padding: 3px 10px;
    background: #eef2ff;
    color: #3730a3;
    border-radius: 999px;
    font-size: 12px;
}

.post-view__footer {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-top: 14px;
    border-top: 1px solid #f1f5f9;
    margin-top: 18px;
    font-size: 13px;
    color: var(--post-text-dim);
}
.post-like {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--post-border);
    background: var(--post-bg);
    user-select: none;
    color: var(--post-text);
    transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}
.post-like[data-liked="true"] {
    background: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
}
.post-like:hover { border-color: var(--post-border-hover); }
.post-like[disabled] { opacity: .5; cursor: not-allowed; }

.post-view__stats {
    display: inline-flex;
    gap: 14px;
    margin-left: auto;
}
.post-view__actions {
    display: flex;
    gap: 8px;
    margin: 18px 0 0;
}

.post-view__status-banner {
    margin-bottom: 14px;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 13px;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

/* ═══════════════════════════════════════════════════════════════
   POST FORM (posts/postPublication.php)
   ═══════════════════════════════════════════════════════════════ */
.post-form-page {
    max-width: 1180px;
    margin: 32px auto;
    padding: 0 16px 40px;
    display: grid;
    grid-template-columns: minmax(0, 2.1fr) minmax(280px, 1fr);
    grid-template-rows: auto auto;
    gap: 20px;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--post-text);
}
/* Десктоп: левая колонка во 1-й row, privacy растянут на 2 row,
   actions висят отдельной row под левой колонкой. */
.post-form-page > .post-form__card--flat { grid-column: 1; grid-row: 1; }
.post-form-page > .post-privacy           { grid-column: 2; grid-row: 1 / span 2; align-self: start; }
.post-form-page > .post-form__actions     { grid-column: 1; grid-row: 2; margin-top: 0; }
.post-form__card {
    background: var(--post-bg);
    border: 1px solid var(--post-border);
    border-radius: 18px;
    box-shadow: var(--post-shadow);
    padding: 18px;
}
.post-form__card--flat { border: none; box-shadow: none; }
.post-form__main-title { font-size: 22px; font-weight: 600; margin-bottom: 18px; }

.post-form__field-title {
    font-size: 14px;
    font-weight: 600;
    margin: 18px 0 8px;
    color: #1f2937;
}

.post-input,
.post-textarea {
    width: 100%;
    font-size: 14px;
    padding: 11px 13px;
    border-radius: var(--post-radius-sm);
    border: 1px solid var(--post-border);
    background: var(--post-bg);
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
    color: var(--post-text);
    font-family: inherit;
}
.post-input:focus,
.post-textarea:focus {
    border-color: var(--color-primary, #0a43ff);
    box-shadow: 0 0 0 1px rgba(10, 67, 255, .18);
}

/* WYSIWYG editor */
.post-editor {
    border-radius: var(--post-radius);
    border: 1px solid var(--post-border);
    overflow: hidden;
    background: #fafafa;
}
.post-editor__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: #f3f4f6;
    border-bottom: 1px solid #e5e7eb;
}
.post-editor__btn {
    border: 1px solid transparent;
    background: transparent;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 13px;
    font-weight: 500;
    color: #4b5563;
    cursor: pointer;
    transition: background-color .15s ease;
}
.post-editor__btn:hover { background: #e5e7eb; color: var(--post-text); }
.post-editor__divider { width: 1px; height: 18px; background: #d1d5db; margin: 0 4px; }
.post-editor__body {
    min-height: 220px;
    padding: 14px 16px;
    background: var(--post-bg);
    outline: none;
    font-size: 15px;
    line-height: 1.55;
}

/* Uploader (фото / файлы) */
.post-uploader {
    border: 1px dashed #cbd5e1;
    border-radius: var(--post-radius);
    padding: 14px;
    background: var(--post-surface-soft);
}
.post-uploader__top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.post-uploader__hint {
    font-size: 13px;
    color: #6b7280;
}
.post-uploader__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--color-primary, #0a43ff);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .15s ease;
}
.post-uploader__btn:hover { background: var(--color-primary--hover, #0830c2); }
.post-uploader__btn input { display: none; }

.post-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    margin-top: 12px;
}
.post-media-tile {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: var(--post-radius-sm);
    overflow: hidden;
    background: #eef2f7;
}
.post-media-tile img,
.post-media-tile video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.post-media-tile__badge {
    position: absolute;
    left: 6px;
    top: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(15, 23, 42, .65);
    color: #fff;
    font-size: 11px;
}
.post-media-tile__remove {
    position: absolute;
    right: 6px;
    top: 6px;
    width: 22px;
    height: 22px;
    line-height: 20px;
    text-align: center;
    border-radius: 999px;
    background: rgba(220, 38, 38, .9);
    color: #fff;
    cursor: pointer;
    font-size: 14px;
}
.post-media-tile__progress {
    position: absolute;
    left: 6px;
    right: 6px;
    bottom: 6px;
    height: 4px;
    background: rgba(0, 0, 0, .25);
    border-radius: 2px;
    overflow: hidden;
}
.post-media-tile__progress > div {
    height: 100%;
    background: var(--color-primary, #0a43ff);
    width: 0;
    transition: width .15s ease;
}

.post-files-list {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.post-file-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--post-bg);
    border: 1px solid var(--post-border);
    border-radius: var(--post-radius-sm);
}
.post-file-row__icon {
    width: 30px; height: 30px;
    flex-shrink: 0;
    background: #eef2ff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4338ca;
}
.post-file-row__main { flex: 1; min-width: 0; }
.post-file-row__name {
    font-size: 14px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.post-file-row__meta { font-size: 12px; color: #6b7280; }
.post-file-row__remove {
    cursor: pointer;
    color: #dc2626;
    padding: 4px 8px;
}

/* ──────────────── Audio tracks (плейлист в постах) ──────────────── */

/* Список треков в редакторе поста */
.post-audio-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}
.post-audio-row {
    display: grid;
    grid-template-columns: 20px 48px 1fr auto 24px;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: var(--post-bg);
    border: 1px solid var(--post-border);
    border-radius: var(--post-radius-sm);
    transition: background 0.12s ease, opacity 0.12s ease;
}
.post-audio-row.is-dragging { opacity: 0.4; }
.post-audio-row--uploading  { opacity: 0.7; }
.post-audio-row__handle {
    cursor: grab;
    color: #94a3b8;
    text-align: center;
    user-select: none;
}
.post-audio-row__handle:active { cursor: grabbing; }
.post-audio-row__cover {
    position: relative;
    width: 48px; height: 48px;
    border-radius: 8px;
    overflow: hidden;
    background: #eef2ff;
    color: #4338ca;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.post-audio-row__cover img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}
.post-audio-row__cover-edit {
    position: absolute;
    right: 2px; bottom: 2px;
    width: 22px; height: 22px;
    border: none;
    border-radius: 50%;
    background: rgba(15,23,42,0.72);
    color: #fff;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.12s ease;
}
.post-audio-row:hover .post-audio-row__cover-edit { opacity: 1; }
.post-audio-row__main {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.post-audio-row__main input {
    width: 100%;
    border: 1px solid transparent;
    background: transparent;
    padding: 4px 6px;
    border-radius: 6px;
    font-size: 14px;
    color: var(--post-text, #0f172a);
    outline: none;
    transition: background 0.12s ease, border-color 0.12s ease;
}
.post-audio-row__main input:hover  { background: rgba(15,23,42,0.04); }
.post-audio-row__main input:focus  {
    background: #fff;
    border-color: var(--color-primary, #1d4ed8);
}
.post-audio-row__title  { font-weight: 500; }
.post-audio-row__artist { font-size: 13px; color: #475569; }
.post-audio-row__title-text {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.post-audio-row__progress {
    margin-top: 4px;
    height: 3px;
    background: rgba(15,23,42,0.08);
    border-radius: 2px;
    overflow: hidden;
}
.post-audio-row__progress > div {
    height: 100%;
    width: 0;
    background: var(--color-primary, #1d4ed8);
    transition: width 0.15s ease;
}
.post-audio-row__duration {
    font-size: 12px;
    color: #6b7280;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.post-audio-row__remove {
    cursor: pointer;
    color: #dc2626;
    padding: 4px;
    text-align: center;
}
.post-audio-row__spacer { width: 24px; }

/* Плейлист в карточке поста и на view-странице */
.post-audio-playlist {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 12px 0;
}
.post-view__playlist { margin: 16px 0; }
.post-audio-playlist__more {
    display: inline-block;
    margin-top: 4px;
    font-size: 13px;
    color: var(--color-primary, #1d4ed8);
    text-decoration: none;
}
.post-audio-playlist__more:hover { text-decoration: underline; }

.post-track-row {
    display: grid;
    grid-template-columns: 40px 48px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: var(--post-bg);
    border: 1px solid var(--post-border);
    border-radius: var(--post-radius-sm);
}
.post-track-row__play {
    width: 40px; height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--color-primary, #1d4ed8);
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.12s ease, background 0.12s ease;
}
/* fa-play — треугольник асимметричен (visual mass смещена влево),
   подвигаем иконку вправо на 1px чтобы оптически встала по центру.
   Для fa-pause смещение не нужно — переопределяем. */
.post-track-row__play > i {
    display: block;
    transform: translateX(1px);
}
.post-track-row__play > i.fa-pause {
    transform: none;
}
.post-track-row__play:hover {
    background: var(--color-primary--hover, #0830c2);
    transform: scale(1.05);
}
.post-track-row__cover {
    width: 48px; height: 48px;
    border-radius: 8px;
    object-fit: cover;
    display: block;
}
.post-track-row__main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.post-track-row__title {
    font-size: 14px;
    font-weight: 500;
    color: var(--post-text, #0f172a);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.post-track-row__artist {
    font-size: 12px;
    color: #6b7280;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.post-track-row__waveform {
    display: block;
    width: 100%;
    height: 36px;
    margin-top: 4px;
    cursor: pointer;
    border-radius: 2px;
    transition: opacity 0.12s ease;
}
.post-track-row__waveform:hover { opacity: 0.88; }
.post-track-row__duration {
    font-size: 12px;
    color: #6b7280;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Узкие экраны — компактнее */
@media (max-width: 480px) {
    .post-audio-row {
        grid-template-columns: 16px 40px 1fr 24px;
        gap: 8px;
    }
    .post-audio-row__duration { display: none; }
    .post-track-row {
        grid-template-columns: 36px 40px 1fr auto;
        gap: 8px;
        padding: 6px 10px;
    }
    .post-track-row__cover { width: 40px; height: 40px; }
    .post-track-row__play  { width: 36px; height: 36px; }
    .post-track-row__waveform { height: 28px; }
}

/* Tags input */
.post-tags-input {
    border: 1px solid var(--post-border);
    border-radius: var(--post-radius);
    padding: 8px 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    background: var(--post-bg);
}
.post-tags-input input {
    border: none;
    outline: none;
    flex: 1;
    min-width: 120px;
    padding: 4px;
    font-family: inherit;
    font-size: 14px;
}
.post-tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 6px 3px 10px;
    background: #eef2ff;
    color: #3730a3;
    border-radius: 999px;
    font-size: 13px;
}
.post-tag-chip__remove {
    cursor: pointer;
    padding: 0 4px;
}

/* Sidebar (settings panel) */
.post-form__sidebar-block {
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}
.post-form__sidebar-block:last-child { border-bottom: 0; }
.post-form__sidebar-title {
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 8px;
}
.post-radio-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.post-radio {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--post-border);
    border-radius: var(--post-radius-sm);
    cursor: pointer;
    font-size: 13px;
    line-height: 1.4;
    background: var(--post-bg);
    transition: border-color .15s ease, background-color .15s ease;
}
.post-radio input { margin-top: 2px; }
.post-radio:hover { background: var(--post-surface-soft); }
.post-radio:has(input:checked) {
    border-color: var(--color-primary, #0a43ff);
    background: var(--post-surface-hint);
}
.post-radio__label { display: flex; flex-direction: column; gap: 2px; }
.post-radio__hint { font-size: 11px; color: #6b7280; }

/* Audience radio с иконкой слева (Boosty-style + наши улучшения) */
.post-audience { gap: 12px; align-items: center; }
.post-audience__icon {
    flex-shrink: 0;
    width: 36px; height: 36px;
    border-radius: 10px;
    background: var(--post-surface-hint);
    color: var(--color-primary, #0a43ff);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
}
.post-audience__title {
    font-size: 13px;
    font-weight: 600;
    color: var(--post-text);
    display: flex; align-items: center; gap: 6px;
}
.post-audience__pill {
    display: inline-block;
    padding: 1px 7px;
    background: #f1f5f9;
    color: var(--post-text-muted);
    border-radius: 999px;
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.post-audience--accent .post-audience__icon {
    background: #fff7ed;
    color: var(--post-cta-accent);
}
.post-audience--soon { opacity: .55; cursor: not-allowed; }
.post-audience--soon:hover { background: var(--post-bg); }
.post-audience--soon input { cursor: not-allowed; }
.post-audience:has(input:checked) .post-audience__icon {
    background: var(--color-primary, #0a43ff);
    color: #fff;
}
.post-audience--accent:has(input:checked) .post-audience__icon {
    background: var(--post-cta-accent);
    color: #fff;
}

/* Conditional блоки — открываются с лёгкой анимацией */
.post-form__conditional {
    /* hidden html-атрибут управляет показом, без CSS-анимации (минимально, но чисто) */
}
.post-form__suffix {
    color: var(--post-text-muted);
    font-size: 13px;
    flex-shrink: 0;
}
.post-form__hint-text {
    font-size: 11px;
    color: var(--post-text-muted);
    margin-top: 4px;
    line-height: 1.4;
}

/* Switch row: лейбл (заголовок + подсказка) слева, switch справа */
.post-switch-row__label {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
    color: var(--post-text);
    font-size: 13px;
}
.post-switch-row__label strong { font-weight: 600; }

/* Disabled switch (когда логика не позволяет менять) */
.post-switch--disabled {
    opacity: .55;
    cursor: not-allowed;
    pointer-events: none;
}

/* Tier picker (заглушка под фазу 7) */
.post-tier-picker {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--post-border);
    border-radius: var(--post-radius-sm);
    background: var(--post-bg);
}
.post-tier-picker__main { flex: 1; min-width: 0; }
.post-tier-picker__title { font-size: 14px; font-weight: 600; color: var(--post-text); }
.post-tier-picker__sub { font-size: 12px; color: var(--post-text-muted); margin-top: 2px; }
.post-tier-picker__caret { color: var(--post-text-muted); }
.post-tier-picker--disabled { opacity: .65; cursor: not-allowed; }

/* Privacy panel — sticky */
.post-privacy { position: sticky; top: 80px; }
@media (max-width: 900px) {
    .post-privacy { position: static; }
}

/* Hybrid lock-card "или" разделитель между двумя CTA */
.post-locked__or {
    text-align: center;
    color: rgba(255, 255, 255, .55);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    margin: 6px 0 4px;
    position: relative;
}
.post-locked__or::before,
.post-locked__or::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 30%;
    height: 1px;
    background: rgba(255, 255, 255, .15);
}
.post-locked__or::before { left: 8%; }
.post-locked__or::after  { right: 8%; }

/* Share-блок (postPublication.php sidebar) — прямая ссылка на пост для шеринга,
   универсальный для всех типов постов (public/paid/tier/free_subs). При наличии
   post_id показываем URL + SharePopup-кнопку, без id — подсказку. */
.post-form__share-label {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 8px;
}
.post-form__share-label strong {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
}
.post-form__share-row {
    display: flex;
    align-items: stretch;
    gap: 6px;
}
.post-form__share-row[hidden] { display: none; }
.post-form__share-url {
    flex: 1;
    min-width: 0;
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--post-border, #e5e7eb);
    border-radius: 8px;
    background: #fff;
    color: var(--post-text, #111827);
    font-size: 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    cursor: text;
    user-select: all;
}
.post-form__share-url:focus { outline: none; border-color: var(--color-primary, #0a43ff); }
.post-form__share-btn {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border: 1px solid var(--post-border, #e5e7eb);
    border-radius: 8px;
    background: #fff;
    color: var(--post-text-muted, #6b7280);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.post-form__share-btn:hover {
    background: var(--color-primary, #0a43ff);
    border-color: var(--color-primary, #0a43ff);
    color: #fff;
}
.post-form__share-hint {
    font-size: 11px;
    color: var(--post-text-muted, #6b7280);
    line-height: 1.4;
}
.post-form__share-hint[hidden] { display: none; }

/* Toggle switch */
.post-switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 13px;
    color: #4b5563;
}
.post-switch {
    position: relative;
    width: 38px;
    height: 22px;
    border-radius: 999px;
    background: #e5e7eb;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color .15s ease;
}
.post-switch__knob {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(15, 23, 42, .35);
    transition: transform .15s ease;
}
.post-switch[data-on="true"] { background: var(--color-primary, #0a43ff); }
.post-switch[data-on="true"] .post-switch__knob { transform: translateX(16px); }

.post-form__schedule-fields {
    margin-top: 8px;
    display: none;
    flex-direction: column;
    gap: 6px;
}
.post-form__schedule-fields--visible { display: flex; }
.post-form__schedule-row { display: flex; gap: 8px; }
.post-form__schedule-row input {
    flex: 1;
    font-size: 13px;
    padding: 9px 11px;
    border-radius: var(--post-radius-sm);
    border: 1px solid var(--post-border);
    outline: none;
    background: var(--post-bg);
    color: var(--post-text);
    font-family: inherit;
}

.post-form__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 18px;
    /* Когда блок вынесен на верхний уровень .post-form-page, у него нет
       padding'а родительской карточки. Дублируем горизонтальный padding,
       чтобы кнопки оптически выравнивались с контентом левой колонки. */
    padding: 0 18px;
}

/* Auto-save индикатор справа от кнопок «Сохранить черновик» / «Опубликовать». */
.post-autosave {
    font-size: 13px;
    color: #6b7280;
    margin-left: auto;
    padding: 4px 8px;
    transition: color 0.15s ease;
    min-width: 1px;
}
.post-autosave[data-state="dirty"]   { color: #9ca3af; }
.post-autosave[data-state="pending"] { color: var(--color-primary, #1d4ed8); }
.post-autosave[data-state="ok"]      { color: #16a34a; }
.post-autosave[data-state="err"]     { color: #dc2626; }

.post-price-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.post-price-row .post-input { flex: 1; }

/* Picked products list (in form) */
.post-picked {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}
.post-picked__row {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 6px 10px;
    background: var(--post-surface-soft);
    border-radius: 8px;
    font-size: 13px;
}
.post-picked__remove {
    margin-left: auto;
    cursor: pointer;
    color: #dc2626;
}

/* Modal (product picker) */
.post-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .55);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}
.post-modal[data-open="true"] { display: flex; }
.post-modal__card {
    background: var(--post-bg);
    border-radius: var(--post-radius);
    width: min(620px, 92vw);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.post-modal__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid #f1f5f9;
}
.post-modal__close {
    cursor: pointer;
    font-size: 20px;
    user-select: none;
    color: var(--post-text-dim);
}
.post-modal__body {
    padding: 12px 18px;
    overflow-y: auto;
}
.post-modal__list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
}
.post-modal__row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--post-border);
    border-radius: var(--post-radius-sm);
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease;
}
.post-modal__row:hover { border-color: var(--post-border-hover); }
.post-modal__row[data-picked="true"] {
    border-color: var(--color-primary, #0a43ff);
    background: var(--post-surface-hint);
}
.post-modal__row img {
    width: 38px; height: 38px;
    object-fit: cover;
    border-radius: 6px;
    background: #e2e8f0;
}

/* Owner-only CTA on profile/feed for creating a post */
.post-create-cta {
    text-align: center;
    padding: 14px;
    background: var(--post-surface-hint);
    border: 1px dashed #c7d2fe;
    border-radius: var(--post-radius);
    margin-bottom: 12px;
}
.post-create-cta a {
    display: inline-block;
    padding: 8px 16px;
    background: var(--color-primary, #0a43ff);
    color: #fff;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
    .post-form-page { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; }
    /* На мобилке колонки складываются в одну — отпускаем явные grid-area
       привязки, чтобы auto-flow шёл строго по DOM-порядку:
       контент → конфиденциальность → кнопки в самом низу. */
    .post-form-page > .post-form__card--flat,
    .post-form-page > .post-privacy,
    .post-form-page > .post-form__actions {
        grid-column: 1;
        grid-row: auto;
    }
    /* Padding левой карточки на мобилке = 16px (см. @max-width:600px правило
       .post-form__card { padding: 16px }), поэтому actions выравниваем по 16px
       тоже. На широких мобилках 600..900px padding всё ещё 18px, разница в 2px
       незаметна — берём универсальные 16px. */
    .post-form-page > .post-form__actions {
        margin-top: 4px;
        padding: 0 16px;
    }
    /* Кнопки full-width стэком, autosave под ними по центру —
       чтобы на узких экранах не было «лесенки» из-за flex-wrap. */
    .post-form__actions .post-cta {
        flex: 1 1 100%;
        justify-content: center;
        padding: 12px 16px;
        font-size: 14px;
    }
    .post-form__actions .post-autosave {
        flex: 1 1 100%;
        margin-left: 0;
        text-align: center;
    }
}
@media (max-width: 600px) {
    .post-card { padding: 12px 14px; border-radius: 12px; }
    .post-view { padding: 16px 14px; border-radius: 14px; }
    .post-view__cover { margin: 12px -14px; }
    .post-view__title { font-size: 20px; }
    .post-view__body { font-size: 15px; }
    .post-form__card { padding: 16px; }
}

/* ═══════════════════════════════════════════════════════════════
   Phase 6.5 — комментарии под постом
   UI/JS унифицированы с продуктами через CommentSystem.js +
   /assets/css/components/comments.css. Локальный wrapper только
   создаёт отступ от action-bar.
   ═══════════════════════════════════════════════════════════════ */

.post-comments-wrap {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--post-border, #e5e7eb);
}

@media (max-width: 540px) {
    .post-comments-wrap { margin-top: 22px; padding-top: 18px; }
}

/* ═══════════════════════════════════════════════════════════════
   Hover-popover «Кто лайкнул» (Phase 6.5+, redesign 2026-05-01).
   Старая модалка `.post-likes-modal` / `.post-likes-overlay` удалена
   вместе с `PostLikesPopup.js` — заменена hover'ом ниже.
   Триггер — любой элемент с `data-likes-hover-post-id`, обработчики
   в `assets/js/modules/PostLikesHover.js`.
   ═══════════════════════════════════════════════════════════════ */
.post-likes-hover {
    position: absolute;
    z-index: 1000;
    min-width: 220px;
    max-width: 280px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .12);
    opacity: 0;
    transform: translateY(4px);
    transition: opacity .15s ease, transform .15s ease;
    pointer-events: none;
}
.post-likes-hover.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.post-likes-hover[data-placement="below"] { transform: translateY(-4px); }
.post-likes-hover[data-placement="below"].is-visible { transform: translateY(0); }

.post-likes-hover__title {
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
}
.post-likes-hover__list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.post-likes-hover__row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #0f172a;
}
.post-likes-hover__ava {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    background: #e2e8f0;
}
.post-likes-hover__name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.post-likes-hover__more {
    margin-top: 4px;
    padding-left: 32px;
    font-size: 12px;
    color: #94a3b8;
}
.post-likes-hover__empty,
.post-likes-hover__loading {
    padding: 4px 0;
    font-size: 13px;
    color: #94a3b8;
    text-align: center;
}
/* На устройствах без hover (touch) popup не нужен — лайк-кнопка остаётся
   функциональной, click работает в PostCard.js. */
@media (hover: none) {
    .post-likes-hover { display: none !important; }
}

/* Лайк-кнопка с встроенным счётчиком — иконка + цифра в одной кнопке. */
.post-action-btn--like { gap: 6px; }
.post-action-btn--like [data-like-count] {
    font-variant-numeric: tabular-nums;
    font-size: 14px;
}

/* ============================================================
   Lightbox — общий просмотрщик изображений (Lightbox.js).
   Используется в ленте, на странице поста, в студии и везде,
   где нужно открыть `<img>` на полный экран с навигацией.
   ============================================================ */
.app-lightbox-lock { overflow: hidden; }

.app-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .92);
    display: none;
    align-items: center;
    justify-content: center;
    /* Выше .menu (z-index: 1000005 в style.css) — иначе sticky-header
       просвечивает поверх затемнения. */
    z-index: 1000010;
}
.app-lightbox.is-open { display: flex; }

/* Stage-контейнер занимает всю свободную область между nav-кнопками.
   Картинка вписывается через object-fit:contain — пропорции родного фото
   сохраняются полностью (никаких обрезок). */
.app-lightbox__stage {
    position: relative;
    width: 92vw;
    height: 92vh;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}
.app-lightbox__img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
    user-select: none;
    -webkit-user-drag: none;
    cursor: default;
    /* Fade-in: пока is-loaded не выставлен — прозрачно, после load() —
       плавно появляется. Убирает «прыжок» при смене кадра. */
    opacity: 0;
    transition: opacity 0.22s ease;
}
.app-lightbox__img.is-loaded { opacity: 1; }

.app-lightbox__spinner {
    position: absolute;
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.20);
    border-top-color: #fff;
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    animation: app-lightbox-spin 0.7s linear infinite;
    transition: opacity 0.15s ease;
}
.app-lightbox__spinner.is-visible { opacity: 1; }
@keyframes app-lightbox-spin {
    to { transform: rotate(360deg); }
}

.app-lightbox__close,
.app-lightbox__nav {
    position: fixed;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid #475569;
    background: #0f172a;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background .15s ease, transform .15s ease;
    padding: 0;
    /* Поверх stage (картинка ≈z:auto в этом stacking-context) и поверх
       header'а сайта (см. .app-lightbox z-index выше). */
    z-index: 1000011;
}
.app-lightbox__close { top: 16px; right: 16px; }
.app-lightbox__nav--prev { left: 16px;  top: 50%; transform: translateY(-50%); }
.app-lightbox__nav--next { right: 16px; top: 50%; transform: translateY(-50%); }
.app-lightbox__close:hover,
.app-lightbox__nav:hover { background: #1e293b; }
.app-lightbox__nav[hidden] { display: none; }

.app-lightbox__counter {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #cbd5e1;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    background: rgba(15, 23, 42, .65);
    padding: 5px 12px;
    border-radius: 999px;
    pointer-events: none;
}
.app-lightbox__counter[hidden] { display: none; }

@media (max-width: 600px) {
    .app-lightbox__nav { width: 40px; height: 40px; font-size: 20px; }
    .app-lightbox__close { width: 40px; height: 40px; font-size: 18px; top: 12px; right: 12px; }
}

/* Курсор-зум на кликабельных изображениях. */
.post-card__cover[data-lightbox-src],
.post-card__cover[data-lightbox-srcs],
.post-view__cover img[data-lightbox-src],
.post-view__media img[data-lightbox-src],
.post-card__media-tile { cursor: zoom-in; }

/* Сетка миниатюр медиа в карточке поста (после обложки). */
.post-card__media {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 6px;
    margin: 0 0 10px;
}
.post-card__media-tile {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: var(--post-radius-sm);
    background: var(--post-surface-soft, #f1f5f9);
}
.post-card__media-tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.post-card__media-tile--more::after {
    content: attr(data-more);
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .55);
    color: #fff;
    font-size: 22px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

/* Бейдж «N фото» поверх обложки в ленте — когда у поста несколько медиа. */
.post-card__cover-wrap { position: relative; }
.post-card__cover-count {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(15, 23, 42, .7);
    color: #fff;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    pointer-events: none;
    backdrop-filter: blur(4px);
}
