/* ============================================================
   assets/blog.css — Нүүр / зөвлөгөө блог UI
   ============================================================ */

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

:root {
    --blog-font: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body.blog-page,
body.patient-home {
    font-family: var(--blog-font) !important;
    padding: 0 !important;
    min-height: 100vh;
}

.blog-shell {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px 100px;
}
.blog-shell.is-narrow { max-width: 760px; }

/* ── Sticky top bar ── */
.cc-topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: rgba(244, 247, 251, .86);
    border-bottom: 1px solid rgba(226, 232, 240, .9);
    margin: 0 -20px 24px;
    padding: 12px 20px;
}
.cc-topbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.cc-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    text-decoration: none;
    color: inherit;
    min-width: 0;
}
.cc-brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(145deg, #2563eb, #3b82f6 55%, #60a5fa);
    display: grid;
    place-items: center;
    box-shadow: 0 6px 16px rgba(37, 99, 235, .28);
    flex-shrink: 0;
    overflow: hidden;
}
.cc-brand-mark.has-logo {
    background: #fff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .06);
}
.cc-brand-mark .cc-brand-logo,
.cc-brand-logo {
    width: 100%;
    height: 100%;
    max-width: 42px;
    max-height: 42px;
    object-fit: contain;
    display: block;
}
.cc-brand-text strong {
    display: block;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -.02em;
    line-height: 1.15;
}
.cc-brand-text span {
    display: block;
    font-size: 12px;
    color: var(--c-muted);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 48vw;
}
.cc-top-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.cc-top-actions a {
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
}
.cc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 14px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 13px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: transform .12s ease, filter .15s ease, box-shadow .15s ease;
}
.cc-btn:active { transform: scale(.97); }
.cc-btn-primary {
    color: #fff !important;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    box-shadow: 0 2px 10px rgba(37, 99, 235, .35);
}
.cc-btn-ghost {
    color: #334155 !important;
    background: #fff;
    border: 1px solid var(--c-border);
}
.cc-link-quiet {
    color: #64748b !important;
    padding: 8px 6px;
}

/* Desktop nav links in topbar */
.cc-desk-nav {
    display: none;
    align-items: center;
    gap: 4px;
}
.cc-desk-nav a {
    padding: 8px 12px;
    border-radius: 9px;
    color: #475569;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
}
.cc-desk-nav a:hover { background: #eff6ff; color: #1d4ed8; }
.cc-desk-nav a.is-active {
    background: #eff6ff;
    color: #1d4ed8;
}

.cc-top-actions-mobile { display: flex; }
@media (min-width: 760px) {
    .cc-desk-nav { display: flex; }
    .cc-top-actions-mobile { display: none !important; }
    .cc-bottomnav { display: none !important; }
    .blog-shell { padding-bottom: 48px; }
    body.patient-home .blog-shell,
    body.patient-shell .blog-shell { padding-bottom: 48px; }
}

/* ── Hero ── */
.blog-hero {
    margin-bottom: 22px;
    animation: blog-rise .45s ease-out;
}
.blog-hero-brand {
    font-size: clamp(28px, 5vw, 40px) !important;
    font-weight: 800;
    letter-spacing: -.04em;
    line-height: 1.1;
    color: #0f172a !important;
    margin: 0 0 10px !important;
    max-width: none !important;
}
.blog-hero h1 {
    font-size: clamp(18px, 2.8vw, 22px);
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.25;
    margin-bottom: 8px;
    color: #334155;
}
.blog-hero > p:not(.blog-hero-brand) {
    font-size: 15px;
    color: #64748b;
    line-height: 1.55;
    max-width: 38rem;
}
.blog-hero-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

/* ── Doctor / status strip ── */
.care-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    margin-bottom: 22px;
    background: rgba(255,255,255,.82);
    border: 1px solid var(--c-border);
    border-radius: 14px;
    box-shadow: var(--shadow-1);
    animation: blog-rise .5s ease-out .05s both;
}
.care-strip-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.care-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(145deg, #dbeafe, #bfdbfe);
    color: #1d4ed8;
    font-weight: 800;
    font-size: 15px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.care-strip strong {
    display: block;
    font-size: 14px;
    font-weight: 800;
}
.care-strip .sub {
    font-size: 12.5px;
    color: var(--c-muted);
    margin-top: 2px;
}
.care-strip .sub a { color: #2563eb; text-decoration: none; font-weight: 700; }
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}
.status-pill::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}
.status-pill.on { background: var(--c-green-bg); color: var(--c-green); border: 1px solid #a7f3d0; }
.status-pill.grace { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }
.status-pill.off { background: var(--c-red-bg); color: var(--c-red); border: 1px solid #fecaca; }

/* ── Grid (нүүр) ── */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    align-items: stretch;
}
.blog-tile {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--c-border);
    border-radius: 16px;
    padding: 0;
    box-shadow: var(--shadow-1);
    text-decoration: none;
    color: inherit;
    overflow: hidden;
    animation: blog-rise .4s ease-out both;
    transition: box-shadow .2s ease, transform .18s ease, border-color .18s ease;
    min-height: 100%;
}
.blog-tile:hover {
    box-shadow: var(--shadow-2);
    transform: translateY(-3px);
    border-color: #bfdbfe;
}
.blog-tile:focus-visible {
    outline: 3px solid rgba(37, 99, 235, .35);
    outline-offset: 2px;
}
.blog-tile:nth-child(1) { animation-delay: .03s; }
.blog-tile:nth-child(2) { animation-delay: .06s; }
.blog-tile:nth-child(3) { animation-delay: .09s; }
.blog-tile:nth-child(4) { animation-delay: .12s; }
.blog-tile:nth-child(5) { animation-delay: .15s; }
.blog-tile:nth-child(6) { animation-delay: .18s; }

.blog-tile-media {
    height: 120px;
    background:
        linear-gradient(145deg, #dbeafe 0%, #eff6ff 45%, #f8fafc 100%);
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 12px 14px;
    position: relative;
}
.blog-tile-media.has-video {
    background:
        linear-gradient(160deg, #0f172a 0%, #1e3a5f 55%, #2563eb 120%);
}
.blog-tile-media .vid-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    background: rgba(15, 23, 42, .35);
    padding: 6px 10px;
    border-radius: 999px;
}
.blog-tile-body {
    padding: 16px 16px 14px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 8px;
}
.blog-tile-title {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -.02em;
    line-height: 1.35;
    color: #0f172a;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.blog-tile-excerpt {
    font-size: 13.5px;
    line-height: 1.55;
    color: #64748b;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}
.blog-tile-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 6px;
    padding-top: 10px;
    border-top: 1px solid #f1f5f9;
}
.blog-tile-meta {
    font-size: 12px;
    color: #94a3b8;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.blog-tile-meta .doc { color: #475569; font-weight: 700; }
.blog-tile-cta {
    font-size: 12.5px;
    font-weight: 800;
    color: #2563eb;
    white-space: nowrap;
}
.blog-tile.is-locked .blog-tile-excerpt { color: #94a3b8; }
.blog-tile.is-locked .blog-tile-media {
    background: linear-gradient(145deg, #f1f5f9, #e2e8f0);
}

/* ── Feed / detail card ── */
.blog-feed {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.blog-card {
    background: #fff;
    border: 1px solid var(--c-border);
    border-radius: 16px;
    padding: 20px 20px 16px;
    box-shadow: var(--shadow-1);
    animation: blog-rise .45s ease-out both;
    transition: box-shadow .2s ease, transform .2s ease;
}
.blog-card:hover {
    box-shadow: var(--shadow-2);
}

.blog-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
}
.blog-card-title {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -.02em;
    line-height: 1.3;
    color: #0f172a;
}
.blog-detail-title {
    font-size: clamp(22px, 3.5vw, 30px);
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1.2;
    color: #0f172a;
    margin-bottom: 8px;
}
.blog-card-meta {
    margin-top: 6px;
    font-size: 12.5px;
    color: #94a3b8;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    align-items: center;
}
.blog-card-meta .doc { color: #475569; font-weight: 700; }

.blog-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 800;
    color: #2563eb;
    text-decoration: none;
    margin-bottom: 16px;
}
.blog-back:hover { text-decoration: underline; }

@media (max-width: 640px) {
    .blog-grid { grid-template-columns: 1fr; }
}

.blog-badge {
    flex-shrink: 0;
    font-size: 11px !important;
    font-weight: 800 !important;
}
.blog-badge.public { background: #e0f2fe !important; color: #0369a1 !important; }
.blog-badge.members { background: #fef3c7 !important; color: #b45309 !important; }

.blog-content {
    font-size: 14.5px;
    line-height: 1.65;
    color: #334155;
    white-space: pre-line;
    margin: 4px 0 12px;
}
.blog-content.is-clamped {
    display: -webkit-box;
    -webkit-line-clamp: 6;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
}
.blog-more {
    background: none;
    border: none;
    color: #2563eb;
    font-weight: 800;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    padding: 0 0 10px;
}
.blog-more:hover { text-decoration: underline; }

.blog-video {
    margin: 4px 0 12px;
    border-radius: 12px;
    overflow: hidden;
    background: #0f172a;
}
.blog-video video {
    width: 100%;
    max-height: 360px;
    display: block;
    background: #000;
}
.blog-video-link {
    display: block;
    padding: 14px 16px;
    color: #38bdf8;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}
.blog-embed {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background: #0f172a;
}
.blog-embed iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.blog-locked {
    background: linear-gradient(180deg, #f8fafc, #f1f5f9);
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    padding: 22px 16px;
    text-align: center;
    color: #64748b;
    font-size: 13.5px;
    line-height: 1.5;
}
.blog-locked strong { display: block; color: #334155; margin-bottom: 4px; }

.blog-empty {
    text-align: center;
    padding: 48px 20px;
    background: rgba(255,255,255,.7);
    border: 1px dashed #cbd5e1;
    border-radius: 16px;
    color: #64748b;
}
.blog-empty strong {
    display: block;
    color: #334155;
    font-size: 16px;
    margin-bottom: 6px;
}

.blog-cta {
    margin-top: 28px;
    padding: 20px;
    border-radius: 16px;
    background:
        linear-gradient(135deg, rgba(37,99,235,.08), rgba(59,130,246,.04)),
        #fff;
    border: 1px solid #bfdbfe;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    animation: blog-rise .45s ease-out .15s both;
}
.blog-cta p {
    margin: 0;
    font-size: 14px;
    color: #1e40af;
    font-weight: 600;
    line-height: 1.45;
    max-width: 28rem;
}

/* Comments */
.comments-section {
    margin-top: 4px;
    border-top: 1px solid #f1f5f9;
    padding-top: 10px;
}
.comments-toggle {
    width: 100%;
    background: #f8fafc;
    border: 1px solid #eef2f7;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 800;
    font-family: inherit;
    color: #2563eb;
    cursor: pointer;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
}
.comments-toggle:hover { background: #eff6ff; }
.comments-list { display: none; margin-top: 10px; }
.comments-list.open { display: block; }
.comment-item {
    background: #f8fafc;
    border: 1px solid #eef2f7;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
    font-size: 13px;
    line-height: 1.5;
}
.comment-author { font-weight: 800; color: #1e293b; font-size: 12.5px; }
.comment-time { color: #94a3b8; font-size: 11px; margin-left: 6px; font-weight: 500; }
.comment-text { margin-top: 4px; color: #334155; white-space: pre-line; }
.comment-form { display: flex; gap: 8px; margin-top: 10px; }
.comment-form input {
    flex: 1;
    padding: 11px 12px !important;
    border-radius: 10px !important;
    font-family: inherit;
}
.comment-send {
    padding: 11px 14px;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
}
.comment-send:disabled { opacity: .55; cursor: not-allowed; }
.comment-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    background: #eff6ff;
    color: #2563eb;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
}
.comments-chev { margin-left: auto; color: #94a3b8; font-size: 12px; font-weight: 700; }

/* ── Mobile bottom nav ── */
.cc-bottomnav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
    background: rgba(255,255,255,.94);
    border-top: 1px solid var(--c-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 -8px 24px rgba(15, 23, 42, .06);
}
.cc-bottomnav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-decoration: none;
    color: #64748b;
    font-size: 11px;
    font-weight: 800;
    padding: 8px 4px;
    border-radius: 12px;
    min-height: 52px;
}
.cc-bottomnav a svg { width: 22px; height: 22px; stroke-width: 2; }
.cc-bottomnav a.is-active {
    color: #1d4ed8;
    background: #eff6ff;
}

@keyframes blog-rise {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .blog-card, .blog-tile, .blog-hero, .care-strip, .blog-cta { animation: none !important; }
    .blog-tile:hover { transform: none; }
}
