/* ═══════════════════════════════════════════════════════════
   News Feed — Telegram Style  v1.3.0
   Accent: #058F8C  |  No CSS variables
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Golos+Text:wght@400;500;600;700&display=swap');

/* ── Wrapper ─────────────────────────────────────────────── */

.nf-wrapper {
    font-family: 'Golos Text', sans-serif;
    max-width: 680px;
    margin: 0 auto;
    padding: 0 16px 40px;
    background: #f0f2f5;
    min-height: 100vh;
}

/* ── Filter bar ──────────────────────────────────────────── */

.nf-filter {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #f0f2f5;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 0 12px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 16px;
    backdrop-filter: blur(8px);
}

.nf-tag-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: 'Golos Text', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
    background: #ffffff;
    border: 1.5px solid #e5e7eb;
    border-radius: 20px;
    padding: 5px 13px;
    cursor: pointer;
    transition: all .18s ease;
    white-space: nowrap;
}

.nf-tag-btn:hover {
    border-color: #058F8C;
    color: #058F8C;
}

.nf-tag-btn.active {
    background: #058F8C;
    border-color: #058F8C;
    color: #ffffff;
}

.nf-tag-count {
    background: rgba(255,255,255,.25);
    border-radius: 10px;
    padding: 0 6px;
    font-size: 11px;
    font-weight: 600;
}

.nf-tag-btn:not(.active) .nf-tag-count {
    background: #e0f4f4;
    color: #058F8C;
}

/* ── Feed ────────────────────────────────────────────────── */

.nf-feed {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ── Card ────────────────────────────────────────────────── */

.nf-card {
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,.07), 0 4px 16px rgba(0,0,0,.04);
    overflow: hidden;
    animation: nf-slide-in .3s ease both;
    transition: box-shadow .2s ease, transform .2s ease;
    cursor: pointer;
}

.nf-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,.1), 0 8px 24px rgba(0,0,0,.07);
    transform: translateY(-1px);
}

@keyframes nf-slide-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.nf-card-inner {
    display: flex;
    flex-direction: column;
}

.nf-card-thumb {
    display: block;
    overflow: hidden;
    max-height: 220px;
}

.nf-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .4s ease;
}

.nf-card:hover .nf-card-thumb img {
    transform: scale(1.02);
}

.nf-card-body {
    padding: 16px 18px 14px;
}

.nf-card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.nf-card-time {
    font-size: 12px;
    color: #6b7280;
}

.nf-card-time::before { content: '🕐 '; }

.nf-card-author {
    font-size: 12px;
    color: #058F8C;
    font-weight: 500;
}

.nf-card-author::before {
    content: '· ';
    color: #e5e7eb;
    margin-right: 2px;
}

.nf-card-title {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    margin: 0 0 8px;
    color: #111827;
    cursor: pointer;
}

.nf-card-excerpt {
    font-size: 14px;
    color: #6b7280;
    line-height: 1.55;
    margin: 0 0 12px;
}

.nf-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.nf-card-tag {
    font-family: 'Golos Text', sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: #047a77;
    background: #e0f4f4;
    border: none;
    border-radius: 10px;
    padding: 3px 10px;
    cursor: pointer;
    transition: background .15s, color .15s;
}

.nf-card-tag:hover {
    background: #058F8C;
    color: #ffffff;
}

/* ── Loader ──────────────────────────────────────────────── */

.nf-loader {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 20px 0;
}

.nf-loader-dot {
    width: 8px;
    height: 8px;
    background: #058F8C;
    border-radius: 50%;
    animation: nf-bounce .9s ease-in-out infinite;
    opacity: .8;
}

.nf-loader-dot:nth-child(2) { animation-delay: .15s; }
.nf-loader-dot:nth-child(3) { animation-delay: .30s; }

@keyframes nf-bounce {
    0%, 80%, 100% { transform: translateY(0);    opacity: .4; }
    40%            { transform: translateY(-8px); opacity: 1; }
}

.nf-end-message {
    text-align: center;
    font-size: 13px;
    color: #6b7280;
    padding: 20px 0 10px;
}

@media (max-width: 600px) {
    .nf-wrapper    { padding: 0 8px 40px; }
    .nf-card-body  { padding: 14px 14px 12px; }
    .nf-card-title { font-size: 15px; }
    .nf-filter     { gap: 6px; }
}

/* ── Modal ───────────────────────────────────────────────── */

.nf-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 99999;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
    padding: 0;
}

.nf-modal-overlay.is-open {
    opacity: 1;
    pointer-events: all;
}

.nf-modal-box {
    background: #ffffff;
    width: 100%;
    max-width: 680px;
    max-height: 92vh;
    border-radius: 20px 20px 0 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    position: relative;
    transform: translateY(40px);
    transition: transform .3s cubic-bezier(.22,1,.36,1);
    font-family: 'Golos Text', sans-serif;
}

@media (min-width: 700px) {
    .nf-modal-overlay { align-items: center; padding: 20px; }
    .nf-modal-box {
        border-radius: 18px;
        transform: translateY(20px) scale(.97);
    }
}

.nf-modal-overlay.is-open .nf-modal-box {
    transform: translateY(0) scale(1);
}

.nf-modal-box::before {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    margin: 12px auto 4px;
}

@media (min-width: 700px) {
    .nf-modal-box::before { display: none; }
}

.nf-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: #f0f2f5;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background .15s, color .15s;
}

.nf-modal-close:hover {
    background: #e5e7eb;
    color: #111827;
}

.nf-modal-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 48px 0;
}

.nf-modal-thumb {
    overflow: hidden;
    max-height: 260px;
}

.nf-modal-thumb img {
    width: 100%;
    object-fit: cover;
    display: block;
}

.nf-modal-inner {
    padding: 20px 22px 28px;
}

.nf-modal-meta {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 10px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.nf-modal-author {
    color: #058F8C;
    font-weight: 500;
}

.nf-modal-title {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.35;
    color: #111827;
    margin-bottom: 16px;
}

/* Post content */
.nf-modal-body {
    font-size: 15px;
    line-height: 1.7;
    color: #111827;
}

.nf-modal-body p              { margin-bottom: 14px; }
.nf-modal-body h2             { font-size: 17px; font-weight: 600; margin: 20px 0 8px; }
.nf-modal-body h3             { font-size: 15px; font-weight: 600; margin: 16px 0 6px; }
.nf-modal-body img            { max-width: 100%; height: auto; border-radius: 8px; margin: 10px 0; display: block; }
.nf-modal-body ul,
.nf-modal-body ol             { padding-left: 20px; margin-bottom: 14px; }
.nf-modal-body li             { margin-bottom: 4px; }
.nf-modal-body a              { color: #058F8C; }

.nf-modal-body blockquote {
    border-left: 3px solid #058F8C;
    padding-left: 14px;
    color: #6b7280;
    margin: 14px 0;
    font-style: italic;
}

/* ── Envira Gallery inside modal ─────────────────────────── */

/* Envira root containers */
.nf-modal-body .envira-gallery-wrap,
.nf-modal-body .envira-gallery-public,
.nf-modal-body .envira-gallery-theme-default,
.nf-modal-body [id^="envira-gallery-"] {
    width: 100% !important;
    max-width: 100% !important;
    margin: 16px 0 !important;
}

/* All images inside Envira */
.nf-modal-body .envira-gallery-wrap img,
.nf-modal-body .envira-gallery-public img,
.nf-modal-body [id^="envira-gallery-"] img {
    max-width: 100% !important;
    height: auto !important;
    border-radius: 6px;
}

/* Envira grid items */
.nf-modal-body .envira-gallery-item {
    border-radius: 6px;
    overflow: hidden;
}

/* Envira inline CSS may set fixed widths — override */
.nf-modal-body .envira-gallery-wrap .envira-gallery-item a,
.nf-modal-body .envira-gallery-wrap .envira-gallery-item img {
    width: 100% !important;
    height: auto !important;
}

/* WordPress core [gallery] shortcode */
.nf-modal-body .gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
    margin: 16px 0;
}

.nf-modal-body .gallery-item {
    overflow: hidden;
    border-radius: 6px;
    margin: 0;
}

.nf-modal-body .gallery-item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
    transition: transform .3s ease;
    margin: 0;
    border-radius: 0;
}

.nf-modal-body .gallery-item:hover img {
    transform: scale(1.04);
}

/* Modal footer */
.nf-modal-footer {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.nf-modal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.nf-modal-tag {
    font-family: 'Golos Text', sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: #047a77;
    background: #e0f4f4;
    border: none;
    border-radius: 10px;
    padding: 4px 11px;
    cursor: pointer;
    transition: background .15s, color .15s;
}

.nf-modal-tag:hover {
    background: #058F8C;
    color: #ffffff;
}

.nf-modal-permalink {
    font-size: 13px;
    color: #6b7280;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color .15s;
}

.nf-modal-permalink:hover { color: #058F8C; }

body.nf-modal-open { overflow: hidden; }

/* ── Comments ────────────────────────────────────────────── */

.nf-comments {
    border-top: 1px solid #e5e7eb;
    padding: 0 22px 28px;
    margin-top: 4px;
}

.nf-comments-header {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    padding: 16px 0 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.nf-comments-icon {
    color: #058F8C;
    display: flex;
    align-items: center;
}

.nf-comments-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 18px;
    min-height: 16px;
}

.nf-comments-loading {
    display: flex;
    gap: 5px;
    padding: 8px 0;
}

.nf-comment-item {
    display: flex;
    gap: 10px;
    animation: nf-slide-in .25s ease both;
}

.nf-comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
    background: #e0f4f4;
}

.nf-comment-bubble {
    flex: 1;
    background: #f0f2f5;
    border-radius: 4px 14px 14px 14px;
    padding: 9px 13px;
}

.nf-comment-bubble-meta {
    display: flex;
    align-items: baseline;
    gap: 7px;
    margin-bottom: 4px;
}

.nf-comment-bubble-author {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
}

.nf-comment-bubble-date {
    font-size: 11px;
    color: #6b7280;
}

.nf-comment-bubble-text {
    font-size: 13px;
    line-height: 1.55;
    color: #111827;
    word-break: break-word;
}

.nf-comments-empty {
    font-size: 13px;
    color: #6b7280;
    padding: 4px 0 8px;
}

.nf-comments-closed {
    font-size: 13px;
    color: #6b7280;
    font-style: italic;
    padding: 8px 0;
}

.nf-comment-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nf-comment-logged-in {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}

.nf-comment-avatar-sm {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.nf-comment-logged-name {
    font-size: 13px;
    font-weight: 500;
    color: #058F8C;
}

.nf-comment-guest-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

@media (max-width: 460px) {
    .nf-comment-guest-fields { grid-template-columns: 1fr; }
}

.nf-comment-input {
    font-family: 'Golos Text', sans-serif;
    font-size: 13px;
    background: #f0f2f5;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    padding: 9px 12px;
    color: #111827;
    width: 100%;
    transition: border-color .15s;
    outline: none;
}

.nf-comment-input:focus { border-color: #058F8C; }

.nf-comment-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.nf-comment-textarea {
    font-family: 'Golos Text', sans-serif;
    font-size: 13px;
    background: #f0f2f5;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    padding: 10px 13px;
    color: #111827;
    resize: none;
    flex: 1;
    line-height: 1.5;
    transition: border-color .15s;
    outline: none;
    min-height: 44px;
    max-height: 120px;
    overflow-y: auto;
}

.nf-comment-textarea:focus { border-color: #058F8C; }

.nf-comment-send {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: #058F8C;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s, transform .1s;
}

.nf-comment-send:hover    { background: #047a77; }
.nf-comment-send:active   { transform: scale(.93); }
.nf-comment-send:disabled { background: #e5e7eb; cursor: not-allowed; }

.nf-comment-notice {
    font-size: 12px;
    border-radius: 8px;
    padding: 8px 12px;
}

.nf-comment-notice.success { background: #e8f5e9; color: #2e7d32; }
.nf-comment-notice.error   { background: #fdecea; color: #c62828; }

/* ── Simply Gallery Block static fallback grid ───────────────────────────────
   Заменяет JS-рендер pgc-sgb-cb статической сеткой в модальном окне
   ─────────────────────────────────────────────────────────────────────────── */

.nf-sgb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 6px;
    margin: 16px 0;
}

.nf-sgb-item {
    display: block;
    overflow: hidden;
    border-radius: 6px;
    background: #f0f2f5;
    aspect-ratio: 16 / 10;
}

.nf-sgb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s ease;
    margin: 0;
    border-radius: 0;
}

.nf-sgb-item:hover img {
    transform: scale(1.04);
}

@media (max-width: 400px) {
    .nf-sgb-grid { grid-template-columns: repeat(2, 1fr); }
}
