/* Imaglance blog: a YouTube-style channel grid and a "watch page" layout
   for each article. Loaded on /blog and /blog/<article> only, after
   style.css, and uses its colour tokens. */

.page-blog,
.page-blog-post {
    --yt-text: var(--text-primary);
    --yt-muted: #606778;
    --yt-chip: rgba(17, 20, 33, 0.06);
    --yt-chip-hover: rgba(17, 20, 33, 0.1);
    --read-font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* ---------- Channel header ---------- */
.blog-channel {
    display: flex;
    align-items: center;
    gap: 22px;
    flex-wrap: wrap;
    margin-bottom: 26px;
}
.blog-channel-avatar {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid var(--card-border);
    display: grid;
    place-items: center;
    box-shadow: var(--shadow-soft);
    flex: none;
}
.blog-channel-avatar img { width: 60px; height: auto; }
.blog-channel h2 { font-size: 2.3rem; line-height: 1; margin: 0; }
.blog-channel p {
    font-family: var(--read-font);
    font-size: 0.95rem;
    color: var(--yt-muted);
    margin: 6px 0 0;
}
.blog-channel .verified { color: var(--yt-muted); font-size: 0.85em; margin-left: 4px; }
.blog-search {
    margin-left: auto;
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 40px;
    overflow: hidden;
    background: var(--input-bg);
    min-width: min(100%, 320px);
}
.blog-search input {
    flex: 1;
    border: 0;
    outline: 0;
    padding: 11px 18px;
    font-family: var(--read-font);
    font-size: 0.95rem;
    background: transparent;
    color: var(--yt-text);
}
.blog-search span {
    padding: 0 18px;
    color: var(--yt-muted);
    border-left: 1px solid var(--border);
    align-self: stretch;
    display: grid;
    place-items: center;
    background: var(--bg-secondary);
}

/* ---------- Category chips ---------- */
.yt-chips {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 6px;
    margin-bottom: 26px;
    scrollbar-width: none;
}
.yt-chips::-webkit-scrollbar { display: none; }
.yt-chip {
    flex: none;
    border: 0;
    cursor: pointer;
    border-radius: 8px;
    padding: 8px 14px;
    background: var(--yt-chip);
    color: var(--yt-text);
    font-family: var(--read-font);
    font-weight: 600;
    font-size: 0.88rem;
    transition: background 0.2s;
}
.yt-chip:hover { background: var(--yt-chip-hover); }
.yt-chip.active { background: #0f0f0f; color: #fff; }

/* ---------- Video-style cards ---------- */
.yt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 36px 18px;
}
.yt-card { display: block; color: inherit; text-decoration: none; }
.yt-thumb {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    overflow: hidden;
    background: #1b1d28;
}
.yt-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}
.yt-card:hover .yt-thumb img { transform: scale(1.04); }
.yt-card:hover .yt-thumb { border-radius: 4px; transition: border-radius 0.25s; }
.yt-badge {
    position: absolute;
    right: 8px;
    bottom: 8px;
    background: rgba(0, 0, 0, 0.82);
    color: #fff;
    font-family: var(--read-font);
    font-size: 0.74rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.2px;
}
.yt-thumb-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #fc3174, #6a1b9a);
    color: #fff;
    font-family: var(--font-heading);
    font-size: 2rem;
    line-height: 1;
    text-transform: uppercase;
}
.yt-meta { display: flex; gap: 12px; margin-top: 12px; }
.yt-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid var(--card-border);
    padding: 5px;
    flex: none;
    object-fit: contain;
}
.yt-title {
    font-family: var(--read-font);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.38;
    color: var(--yt-text);
    margin: 0 0 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.yt-channel,
.yt-stats {
    font-family: var(--read-font);
    font-size: 0.86rem;
    color: var(--yt-muted);
    line-height: 1.5;
}
.yt-channel i { font-size: 0.8em; margin-left: 3px; }
.yt-dot::before { content: '\2022'; margin: 0 5px; }
.yt-empty {
    text-align: center;
    padding: 70px 0;
    font-family: var(--read-font);
    color: var(--yt-muted);
}

/* ---------- Article (watch page) ---------- */
.page-blog-post .section { padding-top: 120px; }
.watch {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 28px;
    align-items: start;
}
.watch-player {
    aspect-ratio: 16 / 9;
    border-radius: 14px;
    overflow: hidden;
    background: #111;
    box-shadow: var(--shadow);
}
.watch-player img { width: 100%; height: 100%; object-fit: cover; display: block; }
.watch-crumbs {
    font-family: var(--read-font);
    font-size: 0.85rem;
    color: var(--yt-muted);
    margin: 18px 0 6px;
}
.watch-crumbs a { color: var(--brand); }
.watch h1 {
    font-size: clamp(2rem, 4vw, 2.9rem);
    line-height: 1.02;
    margin: 0 0 14px;
    color: var(--yt-text);
}
.watch-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}
.watch-owner { display: flex; align-items: center; gap: 12px; }
.watch-owner img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid var(--card-border);
    padding: 6px;
    object-fit: contain;
}
.watch-owner strong { display: block; font-family: var(--read-font); font-size: 0.98rem; color: var(--yt-text); }
.watch-owner span { font-family: var(--read-font); font-size: 0.8rem; color: var(--yt-muted); }
.watch-subscribe {
    background: #0f0f0f;
    color: #fff !important;
    border-radius: 40px;
    padding: 9px 18px;
    font-family: var(--read-font);
    font-weight: 600;
    font-size: 0.9rem;
}
.watch-subscribe:hover { background: var(--brand); }
.watch-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.watch-action {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 0;
    cursor: pointer;
    background: var(--yt-chip);
    color: var(--yt-text);
    border-radius: 40px;
    padding: 9px 15px;
    font-family: var(--read-font);
    font-weight: 600;
    font-size: 0.86rem;
    text-decoration: none;
}
.watch-action:hover { background: var(--yt-chip-hover); }
.watch-desc {
    margin-top: 16px;
    background: var(--yt-chip);
    border-radius: 12px;
    padding: 14px 16px;
    font-family: var(--read-font);
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--yt-text);
}
.watch-desc .watch-desc-stats { font-weight: 700; margin-bottom: 4px; }
.watch-desc .tags a { color: #065fd4; margin-right: 8px; }

/* Table of contents */
.toc {
    margin: 24px 0 8px;
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 16px 18px;
    font-family: var(--read-font);
}
.toc strong { display: block; margin-bottom: 8px; font-size: 0.95rem; }
.toc ol { margin: 0; padding-left: 20px; }
.toc li { margin: 5px 0; font-size: 0.93rem; }
.toc a { color: var(--yt-text); }
.toc a:hover { color: var(--brand); }

/* Article text */
.article-body {
    font-family: var(--read-font);
    font-size: 1.06rem;
    line-height: 1.8;
    color: #2b303b;
    margin-top: 22px;
}
.article-body h2,
.article-body h3 {
    font-family: var(--font-heading);
    color: var(--yt-text);
    line-height: 1.05;
    scroll-margin-top: 100px;
}
.article-body h2 { font-size: 2.1rem; margin: 38px 0 10px; }
.article-body h3 { font-size: 1.6rem; margin: 28px 0 8px; }
.article-body p { margin: 0 0 18px; }
.article-body ul,
.article-body ol { margin: 0 0 18px; padding-left: 24px; }
.article-body li { margin: 6px 0; }
.article-body li::marker { color: var(--brand); font-weight: 700; }
.article-body a { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.article-body strong { color: var(--yt-text); }
.article-body img { max-width: 100%; border-radius: 12px; margin: 8px 0; }
.article-body blockquote {
    margin: 22px 0;
    padding: 14px 18px;
    border-left: 4px solid var(--brand);
    background: var(--brand-subtle);
    border-radius: 8px;
}
.article-body blockquote p:last-child { margin-bottom: 0; }
.article-body pre {
    background: #14161f;
    color: #e8eaf0;
    padding: 16px;
    border-radius: 10px;
    overflow-x: auto;
    font-size: 0.9rem;
}
.article-body code { font-size: 0.92em; background: var(--code-bg); padding: 1px 5px; border-radius: 4px; }
.article-body pre code { background: none; padding: 0; }
.article-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 20px;
    font-size: 0.95rem;
    display: block;
    overflow-x: auto;
}
.article-body th,
.article-body td { border: 1px solid var(--border); padding: 9px 12px; text-align: left; }
.article-body th { background: var(--bg-secondary); }
.article-body hr { border: 0; border-top: 1px solid var(--border); margin: 30px 0; }

/* FAQ */
.blog-faq { margin-top: 34px; }
.blog-faq h2 { font-size: 2.1rem; margin-bottom: 12px; }
.blog-faq details {
    border: 1px solid var(--card-border);
    border-radius: 12px;
    margin-bottom: 10px;
    background: var(--card-bg);
    font-family: var(--read-font);
}
.blog-faq summary {
    cursor: pointer;
    padding: 14px 18px;
    font-weight: 700;
    color: var(--yt-text);
    list-style: none;
    display: flex;
    justify-content: space-between;
    gap: 12px;
}
.blog-faq summary::-webkit-details-marker { display: none; }
.blog-faq summary::after { content: '+'; color: var(--brand); font-size: 1.3rem; line-height: 1; }
.blog-faq details[open] summary::after { content: '\2212'; }
.blog-faq details p { padding: 0 18px 16px; margin: 0; line-height: 1.7; color: #3b4150; }

/* Call to action */
.blog-cta {
    margin-top: 34px;
    border-radius: 16px;
    padding: 26px;
    color: #fff;
    background: linear-gradient(135deg, #fc3174, #6a1b9a);
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}
.blog-cta h3 { color: #fff; font-size: 2rem; margin: 0 0 4px; line-height: 1; }
.blog-cta p { margin: 0; font-family: var(--read-font); opacity: 0.92; }
.blog-cta .btn { margin-left: auto; background: #fff; color: #14161f; }

/* Up next */
.up-next { position: sticky; top: 100px; }
.up-next h2 {
    font-family: var(--read-font);
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 12px;
    color: var(--yt-text);
}
.yt-compact {
    display: grid;
    grid-template-columns: 168px minmax(0, 1fr);
    gap: 10px;
    margin-bottom: 12px;
    color: inherit;
    text-decoration: none;
}
.yt-compact .yt-thumb { border-radius: 8px; }
.yt-compact .yt-title { font-size: 0.9rem; margin-bottom: 2px; }
.yt-compact .yt-channel,
.yt-compact .yt-stats { font-size: 0.78rem; }

.blog-loading { padding: 80px 0; text-align: center; font-family: var(--read-font); color: var(--yt-muted); }

@media (max-width: 1100px) {
    .watch { grid-template-columns: minmax(0, 1fr); }
    .up-next { margin-top: 20px; position: static; }
}
@media (max-width: 640px) {
    .yt-grid { grid-template-columns: 1fr; gap: 28px; }
    .yt-compact { grid-template-columns: 140px minmax(0, 1fr); }
    .watch-actions { margin-left: 0; }
    .article-body { font-size: 1rem; }
    .blog-search { margin-left: 0; width: 100%; }
}
