/* ============================================================
   Blog typography & layout — scoped under .blog-* classes so
   nothing leaks into the marketing site's existing styles.
   Reuses the site's CSS variables (var(--accent), --bg-card,
   --text-primary, --text-secondary, --container-width, etc.)
   defined in css/style.css.
   ============================================================ */

.blog-main {
    padding: 80px 0 0;
    background: var(--bg-dark);
    color: var(--text-primary, #fff);
    min-height: 60vh;
}

/* ---------- Hero (blog index + post pages) ---------- */
.blog-hero {
    margin-top: -80px;  /* counteract .blog-main top padding so hero hugs the nav */
}
.blog-post-hero {
    /* Slightly slimmer than the index hero so the post body lands on screen sooner. */
    min-height: 360px;
    max-height: 360px;
    padding: 90px 0 60px;
}
.blog-post-hero .blog-post-hero-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1.7rem, 3.6vw, 2.6rem);
    line-height: 1.2;
    margin: 12px 0 14px;
    color: var(--text-primary, #fff);
}
.blog-post-hero .page-hero-description {
    font-size: 1.05rem;
    line-height: 1.6;
    max-width: 640px;
    margin: 0 auto;
    color: rgba(255,255,255,0.9);
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.blog-hero-bg {
    background-image: url('../images/services/blog-hero-banner-6.jpeg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}
.blog-hero-bg::before {
    opacity: 0.55;
}
.blog-hero-bg::after {
    background: linear-gradient(180deg, rgba(13, 27, 42, 0.25) 0%, rgba(13, 27, 42, 0.7) 100%);
}
.blog-hero .page-hero-content {
    position: relative;
    z-index: 3;
}
.blog-hero h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(2.2rem, 5vw, 3.4rem);
    font-weight: 700;
    margin: 12px 0 18px;
}
.blog-hero .section-tag {
    color: var(--accent, #8cc63f);
    background: rgba(140, 198, 63, 0.12);
    padding: 4px 14px;
    border-radius: 4px;
    font-family: 'Rubik', sans-serif;
    font-size: 0.8rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}
.blog-hero .page-hero-description {
    font-size: 1.1rem;
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.88);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    max-width: 640px;
    margin: 0 auto;
}

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- Index / listing ---------- */
.blog-index {
    padding: 60px 0 80px;
}
.blog-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 40px;
    align-items: start;
    margin-top: 40px;
}
.blog-main-col { min-width: 0; }
.blog-grid {
    display: grid;
    gap: 24px;
    /* One post per row, each filling the full width of the main column.
       This was repeat(auto-fill, minmax(260px, 1fr)), which left a single
       post sitting in a 260px track with the rest of the row blank, because
       auto-fill keeps the empty tracks it creates. A single full-width
       column avoids that entirely and gives each post its own line. */
    grid-template-columns: 1fr;
    margin: 0;
}

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

/* ---------- Featured post (Neon-inspired) ---------- */
.blog-card-featured {
    background: var(--bg-card, #112233);
    border: 1px solid var(--border-color, rgba(255,255,255,0.1));
    border-radius: 14px;
    overflow: hidden;
    transition: transform 0.25s ease, border-color 0.25s ease;
    margin: 36px 0 8px;
}
.blog-card-featured:hover {
    transform: translateY(-4px);
    border-color: var(--accent, #8cc63f);
}
.blog-card-featured .blog-card-link {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 0;
    color: inherit;
    text-decoration: none;
}
.blog-card-featured .blog-card-image {
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: rgba(255,255,255,0.03);
}
.blog-card-featured .blog-card-image img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}
.blog-card-featured:hover .blog-card-image img {
    transform: scale(1.03);
}
.blog-card-featured .blog-card-body {
    padding: 36px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
}
.blog-card-featured-tag {
    display: inline-block;
    align-self: flex-start;
    background: rgba(140, 198, 63, 0.14);
    color: var(--accent, #8cc63f);
    font-family: 'Rubik', sans-serif;
    font-size: 0.72rem;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    padding: 4px 12px;
    border-radius: 4px;
    margin-bottom: 4px;
}
.blog-card-featured .blog-card-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1.5rem, 2.6vw, 2.05rem);
    line-height: 1.18;
    margin: 6px 0 12px;
    color: var(--text-primary, #fff);
}
.blog-card-featured .blog-card-excerpt {
    font-size: 1.02rem;
    line-height: 1.6;
    color: var(--text-secondary, rgba(255,255,255,0.78));
    margin: 0 0 14px;
}
.blog-card-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--accent, #8cc63f);
    font-family: 'Rubik', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    margin-top: 10px;
    transition: gap 0.2s ease;
}
.blog-card-featured:hover .blog-card-cta { gap: 14px; }

@media (max-width: 820px) {
    .blog-card-featured .blog-card-link { grid-template-columns: 1fr; }
    .blog-card-featured .blog-card-image { aspect-ratio: 16 / 9; }
    .blog-card-featured .blog-card-body { padding: 24px 22px; }
}
.blog-card {
    background: var(--bg-card, #112233);
    border: 1px solid var(--border-color, rgba(255,255,255,0.08));
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.2s ease, border-color 0.2s ease;
}
.blog-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent, #8cc63f);
}
.blog-card-link {
    display: block;
    color: inherit;
    text-decoration: none;
}
.blog-card-image {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: rgba(255,255,255,0.03);
}
.blog-card-image img {
    width: 100%; height: 100%;
    object-fit: cover;
}
.blog-card-body {
    padding: 20px 22px 24px;
}
.blog-card-meta {
    display: flex;
    gap: 12px;
    align-items: center;
    color: var(--text-secondary, rgba(255,255,255,0.6));
    font-size: 0.85rem;
    font-family: 'Rubik', sans-serif;
    margin-bottom: 8px;
}
.blog-card-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.25rem;
    line-height: 1.3;
    margin: 6px 0 10px;
    color: var(--text-primary, #fff);
}
.blog-card-excerpt {
    color: var(--text-secondary, rgba(255,255,255,0.7));
    font-family: 'Ubuntu', sans-serif;
    font-size: 0.95rem;
    line-height: 1.55;
    margin: 0 0 14px;
}
.blog-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.blog-tag {
    font-family: 'Rubik', sans-serif;
    font-size: 0.78rem;
    color: var(--accent, #8cc63f);
    background: rgba(140, 198, 63, 0.08);
    border-radius: 4px;
    padding: 3px 8px;
    text-decoration: none;
}
a.blog-tag:hover {
    background: rgba(140, 198, 63, 0.18);
}

/* ---------- Pagination ---------- */
.blog-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 24px;
    margin-top: 50px;
}
.blog-pagination-status {
    color: var(--text-secondary, rgba(255,255,255,0.6));
    font-family: 'Rubik', sans-serif;
}

/* ---------- Single post ---------- */
.blog-post {
    padding: 40px 0 80px;
}
.blog-post-container {
    max-width: 760px;
}
.blog-post-header {
    margin-bottom: 28px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.08));
}
.blog-post-title {
    /* Title now lives in the hero — but keep the rule for any legacy
       blog-post-title element that may slip through. */
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    line-height: 1.2;
    margin: 16px 0 18px;
}
.blog-post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    color: var(--text-secondary, rgba(255,255,255,0.7));
    font-family: 'Rubik', sans-serif;
    font-size: 0.92rem;
    margin-bottom: 12px;
}
.blog-post-meta i { margin-right: 6px; color: var(--accent, #8cc63f); }
.blog-post-source { font-style: italic; }
.blog-post-source a { color: inherit; text-decoration: underline; text-decoration-style: dotted; }

.blog-post-translation {
    margin: 8px 0 14px;
    color: var(--text-secondary, rgba(255,255,255,0.7));
}
.blog-post-translation i { color: var(--accent, #8cc63f); margin-right: 6px; }
.blog-post-translation a { color: var(--accent, #8cc63f); text-decoration: underline; }

.blog-post-tags {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin: 12px 0 4px;
}

/* ---------- Prose typography (post body) ---------- */
/* Article body type matches the service-detail pages, so a reader moving
   between /services/<slug> and a post sees one voice rather than two.
   Values taken from .service-detail-content in style.css:
     body  1rem / 1.8, --text-secondary, 16px below each paragraph
     h2    2rem   700, --text-primary, 20px below
     h3    1.5rem 600, --text-primary, 40px above / 20px below
   The body was 1.05rem / 1.7 in pure white, which read louder and tighter
   than every other page on the site. */
.prose {
    font-family: 'Ubuntu', sans-serif;
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-secondary);
}
.prose h1, .prose h2, .prose h3, .prose h4 {
    font-family: var(--font-heading);
    line-height: 1.6;
    color: var(--text-primary);
}
.prose h1 { font-size: 2.25rem; font-weight: 700; margin: 40px 0 20px; }
.prose h2 { font-size: 2rem;    font-weight: 700; margin: 40px 0 20px; }
.prose h3 { font-size: 1.5rem;  font-weight: 600; margin: 40px 0 20px; }
.prose h4 { font-size: 1.15rem; font-weight: 600; margin: 32px 0 16px; }
.prose p {
    margin-bottom: 16px;
}
.prose ul, .prose ol, .prose blockquote, .prose pre, .prose table, .prose figure {
    margin: 16px 0;
}
/* strong picks up the brighter colour, as it does in the service lists */
.prose strong { color: var(--text-primary); }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin: 0.3em 0; }
.prose a {
    color: var(--accent, #8cc63f);
    text-decoration: underline;
    text-underline-offset: 3px;
}
.prose blockquote {
    border-left: 3px solid var(--accent, #8cc63f);
    padding: 0.4em 1em;
    color: var(--text-secondary, rgba(255,255,255,0.85));
    background: rgba(255,255,255,0.03);
    margin: 1.4em 0;
}
.prose code {
    font-family: 'Ubuntu Mono', monospace;
    background: rgba(255,255,255,0.06);
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 0.95em;
}
.prose pre {
    background: #0a1622;
    border: 1px solid var(--border-color, rgba(255,255,255,0.08));
    padding: 16px 18px;
    border-radius: 8px;
    overflow-x: auto;
    line-height: 1.5;
    font-size: 0.92rem;
}
.prose pre code {
    background: transparent;
    padding: 0;
}
.prose img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1.5em auto;
    display: block;
}
.prose table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}
.prose th, .prose td {
    border: 1px solid var(--border-color, rgba(255,255,255,0.1));
    padding: 8px 12px;
    text-align: left;
}
.prose th {
    background: rgba(255,255,255,0.04);
    font-family: 'Space Grotesk', sans-serif;
}

/* heading permalink "#" */
.heading-permalink {
    color: var(--text-secondary, rgba(255,255,255,0.4));
    margin-left: 8px;
    text-decoration: none;
    font-weight: 400;
    opacity: 0;
    transition: opacity 0.15s ease;
}
.prose h1:hover .heading-permalink,
.prose h2:hover .heading-permalink,
.prose h3:hover .heading-permalink,
.prose h4:hover .heading-permalink { opacity: 1; }

/* ---------- Discuss-on-LinkedIn CTA ---------- */
.blog-post-cta {
    margin-top: 60px;
    padding: 28px 32px;
    background: var(--bg-card, #112233);
    border: 1px solid var(--border-color, rgba(255,255,255,0.08));
    border-radius: 10px;
    text-align: center;
}
.blog-post-cta-text {
    color: var(--text-secondary, rgba(255,255,255,0.7));
    margin: 0 0 14px;
    font-family: 'Rubik', sans-serif;
}
.blog-post-cta-link i { margin-right: 8px; }

/* ---------- Search ---------- */
.blog-search {
    margin: 0;
    position: relative;
}
/* When standalone (used by other templates) keep the constrained width. */
.blog-index > .container > .blog-search,
.blog-side-widget-search > .blog-search {
    margin: 0;
    max-width: none;
}
/* Search inside the sidebar: drop the card padding so the input sits flush. */
.blog-side-widget-search {
    padding: 14px 14px;
}
.blog-search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.blog-search-input-wrap i {
    position: absolute;
    left: 16px;
    color: var(--text-secondary, rgba(255,255,255,0.5));
    pointer-events: none;
}
.blog-search input[type="search"] {
    width: 100%;
    padding: 12px 16px 12px 44px;
    background: var(--bg-card, #112233);
    border: 1px solid var(--border-color, rgba(255,255,255,0.12));
    color: var(--text-primary, #fff);
    border-radius: 8px;
    font-family: 'Rubik', sans-serif;
    font-size: 1rem;
}
.blog-search input[type="search"]:focus {
    outline: none;
    border-color: var(--accent, #8cc63f);
}
.blog-search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0; right: 0;
    background: var(--bg-card, #112233);
    border: 1px solid var(--border-color, rgba(255,255,255,0.12));
    border-radius: 8px;
    list-style: none;
    padding: 8px 0;
    margin: 0;
    max-height: 60vh;
    overflow-y: auto;
    z-index: 10;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.blog-search-results li { padding: 0; }
.blog-search-results a {
    display: block;
    padding: 10px 18px;
    color: inherit;
    text-decoration: none;
}
.blog-search-results a:hover,
.blog-search-results a:focus {
    background: rgba(140, 198, 63, 0.08);
}
.blog-search-results .result-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1rem;
    margin: 0 0 4px;
}
.blog-search-results .result-excerpt {
    color: var(--text-secondary, rgba(255,255,255,0.7));
    font-size: 0.85rem;
    margin: 0;
}
.blog-search-results .result-empty {
    padding: 14px 18px;
    color: var(--text-secondary, rgba(255,255,255,0.6));
    font-style: italic;
}
.blog-search-results mark {
    background: rgba(140, 198, 63, 0.18);
    color: inherit;
    padding: 0 2px;
    border-radius: 2px;
}

/* ---------- Breadcrumb (post page) ---------- */
.blog-post-container .breadcrumb {
    color: var(--text-secondary, rgba(255,255,255,0.7));
    font-family: 'Rubik', sans-serif;
    font-size: 0.9rem;
    margin: 0 0 22px;
}
.blog-post-container .breadcrumb a {
    color: var(--accent, #8cc63f);
    text-decoration: none;
}
.blog-post-container .breadcrumb a:hover { text-decoration: underline; }
.blog-post-container .breadcrumb-sep {
    margin: 0 6px;
    color: var(--text-secondary, rgba(255,255,255,0.4));
}

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
    .blog-grid { grid-template-columns: 1fr; }
    .blog-main { padding: 60px 0 0; }
    .blog-post-container { padding: 0 16px; }
}

/* ============================================================
   Right sidebar (Featured / Tags / Latest / Newsletter / Follow)
   ============================================================ */
.blog-sidebar {
    position: sticky;
    top: 24px;
    display: flex;
    flex-direction: column;
    gap: 28px;
    align-self: start;
}
.blog-side-widget {
    background: var(--bg-card, #112233);
    border: 1px solid var(--border-color, rgba(255,255,255,0.08));
    border-radius: 10px;
    padding: 22px 22px 24px;
}
.blog-side-heading {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0 0 16px;
    padding-bottom: 12px;
    position: relative;
    border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.06));
}
.blog-side-heading span {
    background: var(--bg-card, #112233);
    position: relative;
}
.blog-side-heading::before {
    content: '';
    position: absolute;
    left: 0; bottom: -1px;
    width: 36px; height: 2px;
    background: var(--accent, #8cc63f);
}
.blog-side-empty {
    color: var(--text-secondary, rgba(255,255,255,0.6));
    font-style: italic;
    margin: 0;
}

/* ── Posts list (used by Featured + Latest) ── */
.blog-side-posts {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.blog-side-post {
    border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.05));
    padding-bottom: 14px;
}
.blog-side-post:last-child { border-bottom: none; padding-bottom: 0; }
.blog-side-post-link {
    display: grid;
    grid-template-columns: 64px 1fr;
    gap: 12px;
    color: inherit;
    text-decoration: none;
    align-items: center;
}
.blog-side-thumb {
    width: 64px; height: 64px;
    border-radius: 6px;
    overflow: hidden;
    background: rgba(255,255,255,0.04);
    flex-shrink: 0;
}
.blog-side-thumb img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.blog-side-thumb-placeholder {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, rgba(140,198,63,0.18), rgba(140,198,63,0.04));
    color: var(--accent, #8cc63f);
    font-size: 1.4rem;
}
.blog-side-meta { min-width: 0; }
.blog-side-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.92rem;
    line-height: 1.3;
    margin: 0 0 4px;
    color: var(--text-primary, #fff);
    /* clamp to 3 lines */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.blog-side-post-link:hover .blog-side-title { color: var(--accent, #8cc63f); }
.blog-side-date {
    color: var(--text-secondary, rgba(255,255,255,0.55));
    font-family: 'Rubik', sans-serif;
    font-size: 0.78rem;
}

/* ── Tag cloud ── */
.blog-side-tagcloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.blog-side-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(140, 198, 63, 0.08);
    color: var(--accent, #8cc63f);
    border-radius: 4px;
    padding: 5px 10px;
    font-family: 'Rubik', sans-serif;
    font-size: 0.85rem;
    text-decoration: none;
    transition: background 0.15s ease;
}
.blog-side-tag:hover { background: rgba(140, 198, 63, 0.18); }
.blog-side-tag-count {
    color: var(--text-secondary, rgba(255,255,255,0.6));
    font-size: 0.75rem;
    background: rgba(255,255,255,0.06);
    padding: 1px 6px;
    border-radius: 8px;
}

/* ── Newsletter widget ── */
.blog-side-widget-newsletter .blog-side-newsletter-text {
    color: var(--text-secondary, rgba(255,255,255,0.7));
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0 0 14px;
}
.blog-side-newsletter-form .newsletter-input-wrap {
    /* The site-wide .newsletter-input-wrap supplies the layout; we just keep
       it consistent here. */
}

/* ── Follow-us social row ── */
.blog-side-social {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.blog-side-social a {
    width: 38px; height: 38px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--border-color, rgba(255,255,255,0.12));
    border-radius: 50%;
    color: var(--text-primary, #fff);
    background: rgba(255,255,255,0.03);
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    text-decoration: none;
}
.blog-side-social a:hover {
    border-color: var(--accent, #8cc63f);
    color: var(--accent, #8cc63f);
    background: rgba(140, 198, 63, 0.08);
}

/* ---------- Long content must not widen the page ----------
   Imported posts carry bare URLs as link text (CIA and Washington Post
   links ran 400–500px) and inline <code> holding whole quoted sentences.
   Neither breaks on its own, so on a 390px screen the article forced the
   whole document to 514px and the page scrolled sideways. Measured before:
   scrollWidth 514 and 445 against a 390 viewport.

   break-word first for older engines, anywhere for the ones that honour it:
   anywhere will break mid-word when there is no better opportunity, which is
   what a 60-character URL needs. */
.blog-post-body a,
.blog-post-body p,
.blog-post-body li,
.blog-post-body h1,
.blog-post-body h2,
.blog-post-body h3,
.blog-post-body h4 {
    overflow-wrap: break-word;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Inline code wraps rather than running off; fenced blocks keep their
   formatting and scroll inside their own box instead of the page. */
.blog-post-body :not(pre) > code {
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
}

.blog-post-body pre {
    max-width: 100%;
    overflow-x: auto;
}

/* Anything that still declares its own width — embeds, tables, images —
   stays inside the column. */
.blog-post-body img,
.blog-post-body table,
.blog-post-body iframe {
    max-width: 100%;
    height: auto;
}
