@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&display=swap');
.bm-blog * { margin: 0; padding: 0; box-sizing: border-box; }
.bm-blog {
font-family: 'Outfit', sans-serif;
color: #F1F5F9;
max-width: 1320px;
margin: 0 auto;
padding: 28px 24px 40px;
}
/* ═══ SHARED CARD ═══ */
.bm-bcard {
position: relative;
overflow: hidden;
background: #0a1525;
border: 1px solid rgba(0,163,255,0.14);
border-radius: 18px;
box-shadow: 0 6px 32px rgba(0,0,0,0.25);
}
.bm-bcard-circuit {
position: absolute;
inset: 0;
z-index: 0;
border-radius: 18px;
overflow: hidden;
}
.bm-bcard-circuit::before {
content: '';
position: absolute;
inset: 0;
background:
linear-gradient(rgba(0,163,255,0.05) 1px, transparent 1px),
linear-gradient(90deg, rgba(0,163,255,0.05) 1px, transparent 1px),
linear-gradient(rgba(0,163,255,0.025) 2px, transparent 2px),
linear-gradient(90deg, rgba(0,163,255,0.025) 2px, transparent 2px);
background-size: 32px 32px, 32px 32px, 96px 96px, 96px 96px;
}
.bm-bcard-circuit::after {
content: '';
position: absolute;
inset: 0;
background:
radial-gradient(ellipse 400px 180px at 15% 30%, rgba(0,102,255,0.04) 0%, transparent 70%),
radial-gradient(ellipse 350px 140px at 85% 60%, rgba(123,104,238,0.03) 0%, transparent 70%);
}
.bm-neon-line {
position: absolute;
top: 0;
left: 50%;
transform: translateX(-50%);
height: 2px;
background: linear-gradient(90deg, transparent, rgba(0,212,255,0.4) 15%, #00A3FF 50%, rgba(0,212,255,0.4) 85%, transparent);
z-index: 1;
}
/* ═══ PAGE HEADER ═══ */
.bm-blog-header {
margin-bottom: 28px;
}
.bm-blog-header-inner {
position: relative;
z-index: 2;
text-align: center;
padding: 48px 40px;
}
.bm-blog-title {
font-size: 34px;
font-weight: 800;
letter-spacing: -0.02em;
margin-bottom: 6px;
color: #F1F5F9;
}
.bm-blog-subtitle {
font-size: 15px;
color: #64748B;
}
/* ═══ CATEGORY TABS ═══ */
.bm-cat-tabs {
display: flex;
gap: 8px;
margin-bottom: 28px;
flex-wrap: wrap;
}
.bm-cat-tab {
padding: 9px 22px;
border-radius: 12px;
border: 1px solid rgba(0,163,255,0.12);
background: rgba(0,163,255,0.04);
color: #94A3B8;
font-family: 'Outfit', sans-serif;
font-size: 14px;
font-weight: 500;
cursor: pointer;
transition: all 0.22s ease;
white-space: nowrap;
}
.bm-cat-tab:hover {
color: #F1F5F9;
background: rgba(0,163,255,0.08);
border-color: rgba(0,163,255,0.2);
}
.bm-cat-tab.active {
color: #00D4FF;
background: rgba(0,163,255,0.12);
border-color: rgba(0,163,255,0.25);
box-shadow: 0 0 18px rgba(0,163,255,0.08);
text-shadow: 0 0 20px rgba(0,212,255,0.25);
}
/* ═══ LAYOUT: MAIN + SIDEBAR ═══ */
.bm-blog-layout {
display: grid;
grid-template-columns: 1fr 340px;
gap: 28px;
align-items: start;
}
/* ═══ POST GRID ═══ */
.bm-post-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 22px;
}
.bm-post-card {
transition: transform 0.25s ease, box-shadow 0.25s ease;
cursor: pointer;
}
.bm-post-card:hover {
transform: translateY(-4px);
box-shadow: 0 12px 44px rgba(0,0,0,0.35), 0 0 36px rgba(0,163,255,0.05);
}
.bm-post-inner {
position: relative;
z-index: 2;
display: flex;
flex-direction: column;
height: 100%;
}
.bm-post-img {
width: 100%;
aspect-ratio: 16/10;
overflow: hidden;
border-radius: 17px 17px 0 0;
background: rgba(0,163,255,0.03);
}
.bm-post-img img {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
transition: transform 0.3s ease;
}
.bm-post-card:hover .bm-post-img img {
transform: scale(1.04);
}
.bm-post-img-placeholder {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
background: linear-gradient(135deg, rgba(0,163,255,0.06), rgba(123,104,238,0.04));
color: #475569;
font-size: 13px;
}
.bm-post-body {
padding: 22px 22px 24px;
flex: 1;
display: flex;
flex-direction: column;
}
.bm-post-cat {
display: inline-block;
font-size: 10.5px;
font-weight: 600;
letter-spacing: 0.1em;
text-transform: uppercase;
color: #00D4FF;
margin-bottom: 10px;
}
.bm-post-title {
font-size: 18px;
font-weight: 700;
line-height: 1.3;
color: #F1F5F9;
margin-bottom: 10px;
}
.bm-post-title a {
text-decoration: none;
color: inherit;
transition: color 0.2s;
}
.bm-post-title a:hover { color: #00D4FF; }
.bm-post-excerpt {
font-size: 13.5px;
line-height: 1.6;
color: #64748B;
margin-bottom: 16px;
flex: 1;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
}
.bm-post-meta {
font-size: 12px;
color: #475569;
}
/* ═══ LOAD MORE ═══ */
.bm-load-more-wrap {
text-align: center;
margin-top: 28px;
}
.bm-load-more {
padding: 12px 36px;
border-radius: 12px;
border: 1px solid rgba(0,163,255,0.18);
background: rgba(0,163,255,0.06);
color: #00D4FF;
font-family: 'Outfit', sans-serif;
font-size: 14px;
font-weight: 600;
cursor: pointer;
transition: all 0.22s ease;
}
.bm-load-more:hover {
background: rgba(0,163,255,0.12);
border-color: rgba(0,163,255,0.3);
box-shadow: 0 0 20px rgba(0,163,255,0.1);
}
.bm-load-more:disabled {
opacity: 0.4;
cursor: default;
}
/* ═══ LOADING STATE ═══ */
.bm-loading {
text-align: center;
padding: 60px 0;
color: #64748B;
font-size: 14px;
grid-column: 1 / -1;
}
.bm-spinner {
display: inline-block;
width: 28px;
height: 28px;
border: 2.5px solid rgba(0,163,255,0.15);
border-top-color: #00A3FF;
border-radius: 50%;
animation: bmSpin 0.7s linear infinite;
margin-bottom: 12px;
}
@keyframes bmSpin { to { transform: rotate(360deg); } }
/* ═══ SIDEBAR ═══ */
.bm-sidebar {
display: flex;
flex-direction: column;
gap: 22px;
position: sticky;
top: 130px;
}
.bm-side-section {
padding: 24px;
}
.bm-side-section .bm-neon-line { width: 35%; }
.bm-side-inner {
position: relative;
z-index: 2;
}
.bm-side-title {
font-size: 11.5px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.12em;
color: #00D4FF;
text-shadow: 0 0 18px rgba(0,212,255,0.2);
margin-bottom: 18px;
}
/* Search */
.bm-search-wrap {
display: flex;
gap: 8px;
}
.bm-search-input {
flex: 1;
padding: 11px 16px;
border-radius: 11px;
border: 1px solid rgba(0,163,255,0.16);
background: rgba(0,0,0,0.25);
color: #F1F5F9;
font-family: 'Outfit', sans-serif;
font-size: 13.5px;
outline: none;
transition: border-color 0.2s;
}
.bm-search-input::placeholder { color: #475569; }
.bm-search-input:focus { border-color: rgba(0,163,255,0.35); }
.bm-search-btn {
padding: 11px 16px;
border-radius: 11px;
border: none;
background: rgba(0,163,255,0.1);
color: #00D4FF;
cursor: pointer;
transition: background 0.2s;
display: flex;
align-items: center;
}
.bm-search-btn:hover { background: rgba(0,163,255,0.18); }
.bm-search-btn svg { width: 18px; height: 18px; }
/* Sidebar lists */
.bm-side-list {
list-style: none;
}
.bm-side-list li {
border-bottom: 1px solid rgba(0,163,255,0.06);
}
.bm-side-list li:last-child { border-bottom: none; }
.bm-side-list a {
display: flex;
justify-content: space-between;
align-items: center;
padding: 11px 0;
text-decoration: none;
color: #94A3B8;
font-size: 14px;
transition: color 0.2s;
cursor: pointer;
}
.bm-side-list a:hover { color: #F1F5F9; }
.bm-side-list .bm-count {
font-size: 12px;
color: #475569;
background: rgba(0,163,255,0.06);
padding: 2px 10px;
border-radius: 8px;
}
/* Recent/Popular post list */
.bm-side-post {
display: flex;
gap: 14px;
padding: 12px 0;
border-bottom: 1px solid rgba(0,163,255,0.06);
text-decoration: none;
cursor: pointer;
transition: opacity 0.2s;
}
.bm-side-post:last-child { border-bottom: none; }
.bm-side-post:hover { opacity: 0.8; }
.bm-side-post-img {
width: 64px;
height: 48px;
border-radius: 8px;
overflow: hidden;
flex-shrink: 0;
background: rgba(0,163,255,0.04);
}
.bm-side-post-img img {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
}
.bm-side-post-text {
flex: 1;
min-width: 0;
}
.bm-side-post-title {
font-size: 13.5px;
font-weight: 600;
color: #CBD5E1;
line-height: 1.35;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.bm-side-post-date {
font-size: 11.5px;
color: #475569;
margin-top: 4px;
}
/* ═══ RESPONSIVE ═══ */
@media (max-width: 1024px) {
.bm-blog-layout {
grid-template-columns: 1fr;
}
.bm-sidebar {
position: static;
display: grid;
grid-template-columns: repeat(2, 1fr);
}
}
@media (max-width: 768px) {
.bm-blog { padding: 20px 16px 32px; }
.bm-blog-title { font-size: 26px; }
.bm-post-grid { grid-template-columns: 1fr; }
.bm-sidebar { grid-template-columns: 1fr; }
}
(function(){
// ── CONFIG ──
var API = '/wp-json/wp/v2';
var PER_PAGE = 8;
var page = 1;
var activeCat = 'all';
var searchQuery = '';
var categories = {};
var mediaCache = {};
var totalPages = 1;
var gridEl = document.getElementById('bmPostGrid');
var tabsEl = document.getElementById('bmCatTabs');
var loadBtn = document.getElementById('bmLoadMore');
var searchInput = document.getElementById('bmSearchInput');
var searchBtn = document.getElementById('bmSearchBtn');
// ── HELPERS ──
function stripHTML(html) {
var tmp = document.createElement('div');
tmp.innerHTML = html;
return tmp.textContent || tmp.innerText || '';
}
function formatDate(dateStr) {
var d = new Date(dateStr);
return d.toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' });
}
function fetchJSON(url) {
return fetch(url).then(function(r) {
var tp = r.headers.get('X-WP-TotalPages');
if (tp) totalPages = parseInt(tp);
return r.json();
});
}
// ── GET FEATURED IMAGE ──
function getMedia(id) {
if (!id) return Promise.resolve(null);
if (mediaCache[id]) return Promise.resolve(mediaCache[id]);
return fetchJSON(API + '/media/' + id + '?_fields=source_url')
.then(function(m) {
mediaCache[id] = m.source_url;
return m.source_url;
})
.catch(function() { return null; });
}
// ── RENDER POST CARD ──
function renderPostCard(post, catName, imgUrl) {
var excerpt = stripHTML(post.excerpt.rendered);
if (excerpt.length > 140) excerpt = excerpt.substring(0, 140) + '...';
return '
' +
'
' +
'
' +
'
' +
(imgUrl
? '

'
: '
No image
') +
'
' +
'
' +
'
' + catName + '' +
'
' +
'
' + excerpt + '
' +
'
' + formatDate(post.date) + '' +
'
' +
'
' +
'
';
}
// ── SIDEBAR POST ──
function renderSidePost(post, imgUrl) {
return '
' +
'' +
(imgUrl
? '

'
: '') +
'
' +
'' +
'
' + post.title.rendered + '
' +
'
' + formatDate(post.date) + '
' +
'
' +
'';
}
// ── LOAD POSTS ──
function loadPosts(append) {
if (!append) {
page = 1;
gridEl.innerHTML = '
';
}
var url = API + '/posts?per_page=' + PER_PAGE + '&page=' + page + '&_embed';
if (activeCat !== 'all') url += '&categories=' + activeCat;
if (searchQuery) url += '&search=' + encodeURIComponent(searchQuery);
fetchJSON(url).then(function(posts) {
if (!posts.length && !append) {
gridEl.innerHTML = '
No posts found.
';
loadBtn.style.display = 'none';
return;
}
var promises = posts.map(function(post) {
var catId = post.categories && post.categories[0];
var catName = (catId && categories[catId]) ? categories[catId].name : 'Uncategorized';
var mediaId = post.featured_media;
return getMedia(mediaId).then(function(imgUrl) {
return renderPostCard(post, catName, imgUrl);
});
});
Promise.all(promises).then(function(cards) {
if (append) {
gridEl.insertAdjacentHTML('beforeend', cards.join(''));
} else {
gridEl.innerHTML = cards.join('');
}
loadBtn.style.display = (page < totalPages) ? 'inline-block' : 'none';
});
}).catch(function() {
if (!append) gridEl.innerHTML = '
Could not load posts.
';
});
}
// ── LOAD CATEGORIES ──
function loadCategories() {
fetchJSON(API + '/categories?per_page=50&_fields=id,name,slug,count').then(function(cats) {
cats.forEach(function(c) {
if (c.slug === 'uncategorized' || c.count === 0) return;
categories[c.id] = c;
var btn = document.createElement('button');
btn.className = 'bm-cat-tab';
btn.setAttribute('data-cat', c.id);
btn.textContent = c.name;
tabsEl.appendChild(btn);
});
// Tab click handlers
tabsEl.querySelectorAll('.bm-cat-tab').forEach(function(tab) {
tab.addEventListener('click', function() {
tabsEl.querySelectorAll('.bm-cat-tab').forEach(function(t) { t.classList.remove('active'); });
tab.classList.add('active');
activeCat = tab.getAttribute('data-cat');
searchQuery = '';
searchInput.value = '';
loadPosts(false);
});
});
});
}
// ── SIDEBAR: RECENT POSTS ──
function loadRecentPosts() {
fetchJSON(API + '/posts?per_page=5&_fields=id,title,date,link,featured_media').then(function(posts) {
var el = document.getElementById('bmRecentPosts');
var promises = posts.map(function(post) {
return getMedia(post.featured_media).then(function(img) {
return renderSidePost(post, img);
});
});
Promise.all(promises).then(function(html) {
el.innerHTML = html.join('');
});
});
}
// ── SIDEBAR: POPULAR POSTS (by comment count, fallback to recent) ──
function loadPopularPosts() {
// WP REST API doesn't natively sort by popularity, so we use orderby=date as fallback
// For true popularity, install WP-PostViews or use a plugin. This fetches recent as placeholder.
fetchJSON(API + '/posts?per_page=5&orderby=date&_fields=id,title,date,link,featured_media').then(function(posts) {
var el = document.getElementById('bmPopularPosts');
var promises = posts.map(function(post) {
return getMedia(post.featured_media).then(function(img) {
return renderSidePost(post, img);
});
});
Promise.all(promises).then(function(html) {
el.innerHTML = html.join('');
});
});
}
// ── SIDEBAR: ARCHIVES ──
function loadArchives() {
// Fetch last 100 posts to compute monthly archives
fetchJSON(API + '/posts?per_page=100&_fields=date').then(function(posts) {
var months = {};
posts.forEach(function(p) {
var d = new Date(p.date);
var key = d.getFullYear() + '-' + String(d.getMonth() + 1).padStart(2, '0');
var label = d.toLocaleDateString('en-US', { month: 'long', year: 'numeric' });
if (!months[key]) months[key] = { label: label, count: 0, year: d.getFullYear(), month: d.getMonth() + 1 };
months[key].count++;
});
var el = document.getElementById('bmArchives');
var keys = Object.keys(months).sort().reverse();
if (!keys.length) {
el.innerHTML = '
No archives yet';
return;
}
el.innerHTML = keys.map(function(k) {
var m = months[k];
var url = '/' + m.year + '/' + String(m.month).padStart(2, '0') + '/';
return '
' + m.label + '' + m.count + '';
}).join('');
});
}
// ── SEARCH ──
function doSearch() {
var q = searchInput.value.trim();
if (!q) return;
searchQuery = q;
activeCat = 'all';
tabsEl.querySelectorAll('.bm-cat-tab').forEach(function(t) { t.classList.remove('active'); });
tabsEl.querySelector('[data-cat="all"]').classList.add('active');
loadPosts(false);
}
searchBtn.addEventListener('click', doSearch);
searchInput.addEventListener('keydown', function(e) {
if (e.key === 'Enter') doSearch();
});
// ── LOAD MORE ──
loadBtn.addEventListener('click', function() {
page++;
loadPosts(true);
});
// ── INIT ──
loadCategories();
loadPosts(false);
loadRecentPosts();
loadPopularPosts();
loadArchives();
})();