/* Blog section — index, single post, category/tag archives.
   Reuses the site's existing tokens (--card-bg, --border-color, --primary-*, --primary-gradient)
   from main.css so it themes correctly with the existing dark/.light-mode toggle. */

:root {
    --blog-muted: rgba(241, 245, 249, 0.68);
    --blog-divider: rgba(255, 255, 255, 0.1);
    --blog-pill-bg: rgba(255, 255, 255, 0.06);
    --blog-pill-border: rgba(255, 255, 255, 0.14);
}
.light-mode {
    --blog-muted: rgba(30, 41, 59, 0.68);
    --blog-divider: rgba(0, 0, 0, 0.1);
    --blog-pill-bg: rgba(22, 66, 60, 0.05);
    --blog-pill-border: rgba(22, 66, 60, 0.15);
}

.blog-wrap {
    max-width: 1200px;
    margin: 0 auto;
    /* The site nav is position:fixed (see .navbar in main.css), so every page needs
       enough top padding to clear it — 8rem matches the site-wide .section convention
       already used for this exact purpose (see home.css). */
    padding: 8rem 1.5rem 4rem;
}

.blog-eyebrow {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    color: var(--primary-light);
}

/* ---------- Masthead (index) ---------- */
.blog-masthead {
    padding: 0 0 1.9rem;
    border-bottom: 1px solid var(--blog-divider);
    margin-bottom: 2.25rem;
}
.blog-masthead-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
}
.blog-masthead h1 {
    margin: 0.4rem 0 0;
    font-size: clamp(1.8rem, 3.2vw, 2.4rem);
    font-weight: 700;
}
.blog-masthead p {
    margin: 0.6rem 0 0;
    color: var(--blog-muted);
    max-width: 52ch;
    line-height: 1.6;
}

.blog-filter-pills {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.blog-pill {
    padding: 0.5rem 1rem;
    border-radius: 999px;
    background: var(--blog-pill-bg);
    border: 1px solid var(--blog-pill-border);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--blog-muted);
    text-decoration: none;
    display: inline-block;
}
.blog-pill.is-active {
    background: var(--primary-gradient);
    border-color: transparent;
    color: #fff;
}

/* Compact variant for use inline inside .blog-meta-row (e.g. post header category tag) */
.blog-pill-category {
    padding: 0.28rem 0.7rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--primary-gradient);
    border-color: transparent;
    color: #fff;
}
.blog-pill-category:hover { opacity: 0.9; }

/* ---------- Archive header (category/tag pages) ---------- */
.blog-archive-header {
    display: flex;
    gap: 1.25rem;
    align-items: center;
    padding: 0 0 2rem;
    border-bottom: 1px solid var(--blog-divider);
    margin-bottom: 2.25rem;
}
.blog-archive-icon {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
    font-size: 1.4rem;
}
.blog-archive-header h1 {
    margin: 0.15rem 0 0.4rem;
    font-size: 1.7rem;
    font-weight: 700;
}
.blog-archive-header p {
    margin: 0;
    color: var(--blog-muted);
    max-width: 60ch;
    line-height: 1.6;
}
.blog-archive-count {
    display: block;
    margin-top: 0.4rem;
    color: var(--blog-muted);
    font-size: 0.85rem;
    font-weight: 600;
}

/* ---------- Featured post banner (index only) ---------- */
.blog-featured {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    border-radius: 16px;
    overflow: hidden;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: var(--tool-card-shadow);
    margin-bottom: 2.75rem;
}
.blog-featured-media {
    background: var(--primary-gradient);
    aspect-ratio: 1200 / 630;
    display: flex;
    align-items: center;
    justify-content: center;
}
.blog-featured-media img { width: 100%; height: 100%; object-fit: cover; }
.blog-featured-media i { font-size: 3.2rem; color: rgba(255, 255, 255, 0.9); }
.blog-featured-body {
    padding: 2rem 2.2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.85rem;
}
.blog-featured-body h2 { margin: 0; font-size: 1.5rem; line-height: 1.28; font-weight: 700; }
.blog-featured-body h2 a { color: inherit; text-decoration: none; }
.blog-featured-body h2 a:hover { text-decoration: underline; }
.blog-featured-body p { margin: 0; color: var(--blog-muted); line-height: 1.65; }
.blog-cta-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--primary-medium);
    text-decoration: none;
    margin-top: 0.2rem;
}
.blog-cta-link:hover { text-decoration: underline; }

/* ---------- Meta row ---------- */
.blog-meta-row {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    color: var(--blog-muted);
    font-size: 0.8rem;
    flex-wrap: wrap;
    justify-content: center;
}
.blog-meta-row i { margin-right: 0.3rem; }

/* ---------- Card grid (index / archive / related) ---------- */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}
.blog-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none;
    color: inherit;
}
.blog-card:hover { transform: translateY(-3px); box-shadow: var(--tool-card-shadow); }
.blog-card-media {
    aspect-ratio: 1200 / 630;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.blog-card-media img { width: 100%; height: 100%; object-fit: cover; }
.blog-card-media i { font-size: 1.8rem; color: rgba(255, 255, 255, 0.85); }
.blog-card-cat {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    color: #fff;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
}
.blog-card-body {
    padding: 1.1rem 1.2rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    flex: 1;
}
.blog-card-body h3 { margin: 0; font-size: 1rem; line-height: 1.4; font-weight: 700; }
.blog-card-body p { margin: 0; font-size: 0.86rem; color: var(--blog-muted); line-height: 1.6; flex: 1; }

/* ---------- Pagination ---------- */
.blog-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.4rem;
    margin: 0.5rem 0 3rem;
}
.blog-pagination-link,
.blog-pagination-current {
    min-width: 38px;
    height: 38px;
    padding: 0 0.8rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--blog-muted);
    font-weight: 600;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}
.blog-pagination-link:hover { background: var(--primary-color); color: #fff; }
.blog-pagination-current { background: var(--primary-gradient); border-color: transparent; color: #fff; }

/* ---------- Single post ---------- */
.blog-breadcrumb {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    color: var(--blog-muted);
    font-size: 0.82rem;
    max-width: 760px;
    margin: 0 auto;
    flex-wrap: wrap;
}
.blog-breadcrumb a { color: var(--blog-muted); text-decoration: none; }
.blog-breadcrumb a:hover { color: var(--primary-light); }
.blog-breadcrumb .sep { opacity: 0.5; }

.blog-post-header { padding: 1rem 0 1.75rem; max-width: 760px; margin: 0 auto; }
.blog-post-header h1 {
    margin: 0.75rem 0 0;
    font-size: clamp(1.8rem, 3.4vw, 2.4rem);
    line-height: 1.2;
    font-weight: 700;
    color: var(--primary-color);
    text-align: center;
}
.blog-post-header .blog-meta-row { margin-top: 1rem; }

.blog-post-hero {
    max-width: 900px;
    aspect-ratio: 1200 / 630;
    border-radius: 16px;
    background: var(--primary-gradient);
    margin: 0 auto 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.blog-post-hero img { width: 100%; height: 100%; object-fit: cover; }
.blog-post-hero i { font-size: 4rem; color: rgba(255, 255, 255, 0.9); }

.blog-post-layout {
    max-width: 900px;
    margin: 2.25rem auto 0;
    display: grid;
    grid-template-columns: 52px 1fr;
    gap: 1.75rem;
}
.blog-share-rail {
    position: sticky;
    top: 88px;
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.blog-share-btn {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--blog-muted);
    cursor: pointer;
    text-decoration: none;
}
.blog-share-btn:hover { color: #fff; background: var(--primary-gradient); border-color: transparent; }

.blog-article {
    max-width: 700px;
    font-size: 1.03rem;
    line-height: 1.8;
}
.blog-article p { margin: 0 0 1.35rem; }
.blog-article h2 { font-size: 1.35rem; font-weight: 700; margin: 2.2rem 0 1rem; }
.blog-article h3 { font-size: 1.15rem; font-weight: 700; margin: 1.8rem 0 0.85rem; }
.blog-article ul, .blog-article ol { margin: 0 0 1.35rem 1.3rem; }
.blog-article li { margin-bottom: 0.4rem; line-height: 1.7; }
.blog-article blockquote {
    margin: 0 0 1.35rem;
    padding: 0.9rem 1.2rem;
    border-left: 3px solid var(--primary-medium);
    background: var(--blog-pill-bg);
    border-radius: 0 8px 8px 0;
    color: var(--blog-muted);
}
.blog-article img { max-width: 100%; height: auto; border-radius: 10px; margin: 0.5rem 0 1.35rem; }
.blog-article a { color: var(--primary-light); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.blog-article a:hover { text-decoration-thickness: 2px; }
.blog-article code {
    background: var(--blog-pill-bg);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
}
.blog-article pre {
    background: var(--blog-pill-bg);
    padding: 1rem 1.2rem;
    border-radius: 10px;
    overflow-x: auto;
    margin: 0 0 1.35rem;
}
.blog-article table { width: 100%; border-collapse: collapse; margin: 0 0 1.35rem; }
.blog-article th, .blog-article td { padding: 0.6rem 0.8rem; border: 1px solid var(--border-color); text-align: left; }

.blog-section-title { max-width: 700px; margin: 0 auto 1.1rem; font-size: 1.15rem; font-weight: 700; }
.blog-section-title.wide { max-width: 900px; }
.blog-section-sub { max-width: 900px; margin: -0.8rem auto 1.2rem; color: var(--blog-muted); font-size: 0.86rem; }

/* Key Takeaways / FAQ / Try These Tools are rendered via render_checks_section() /
   render_faq_section() / render_related_tools_section() (includes/templates/*.php).
   .section / .section-header / .faq-section / .faq-item are already styled in
   home.css (loaded site-wide), but .social-tags-section (checks-section.php's
   wrapper) and .related-tools-section/.related-tool-card only exist in
   page-specific tool CSS (tools/seo-analyzer.css, tools/tool-base.css) that
   blog pages don't load — so those two are defined here, adapted to the same
   --card-bg/--border-color tokens the rest of this file already uses. */

.social-tags-section {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.related-tools-section {
    max-width: 900px;
    margin: 0 auto;
}
.related-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}
.related-tool-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 1rem;
}
.related-tool-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--tool-card-shadow);
}
.related-tool-icon {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    background: var(--primary-gradient);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: #fff;
}
.related-tool-content { flex: 1; }
.related-tool-content h3 { margin: 0 0 0.5rem; font-size: 1.1rem; font-weight: 600; }
.related-tool-content h3 a { color: var(--text-color); text-decoration: none; transition: var(--transition); }
.related-tool-content h3 a:hover { color: var(--primary-medium); }
.related-tool-content p { margin: 0; font-size: 0.9rem; color: var(--blog-muted); line-height: 1.4; }
.no-related-tools { text-align: center; padding: 2rem; color: var(--blog-muted); font-style: italic; }

@media (max-width: 760px) {
    .related-tools-grid { grid-template-columns: 1fr; gap: 1rem; }
    .related-tool-card { padding: 1.2rem; }
    .related-tool-icon { width: 40px; height: 40px; font-size: 1.1rem; }
}

.blog-prevnext {
    max-width: 900px;
    margin: 0 auto 2.75rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.blog-pn-link {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.1rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    text-decoration: none;
    color: inherit;
}
.blog-pn-link:hover { border-color: var(--primary-medium); }
.blog-pn-link.next { text-align: right; align-items: flex-end; }
.blog-pn-dir {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--blog-muted);
}
.blog-pn-title { font-size: 0.9rem; font-weight: 700; line-height: 1.4; }

.blog-related { max-width: 900px; margin: 0 auto 3.5rem; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
    .blog-featured { grid-template-columns: 1fr; }
    .blog-post-layout { grid-template-columns: 1fr; }
    .blog-share-rail { position: static; flex-direction: row; justify-content: center; margin-bottom: 0.5rem; }
    .blog-prevnext { grid-template-columns: 1fr; }
    .blog-masthead-row { flex-direction: column; align-items: flex-start; }
    .blog-archive-header { flex-direction: column; align-items: flex-start; text-align: left; }
}
