/*
Theme Name: sxHUB
Description: Clean modern blog theme
Version: 1.0
Author: sxHUB
*/

/* === RESET === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:     #0f172a;
  --accent:      #3b82f6;
  --accent-dark: #2563eb;
  --text:        #1e293b;
  --muted:       #64748b;
  --bg:          #f1f5f9;
  --card:        #ffffff;
  --border:      #e2e8f0;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.07), 0 4px 12px rgba(0,0,0,.05);
  --shadow-md:   0 8px 30px rgba(0,0,0,.12);
  --radius:      12px;
  --font:        -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 16px;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }
img { max-width: 100%; height: auto; display: block; }

/* === HEADER === */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 6px rgba(0,0,0,.05);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 28px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.site-logo {
  font-size: 1.45rem;
  font-weight: 900;
  color: var(--primary);
  letter-spacing: -0.5px;
  white-space: nowrap;
}
.site-logo span { color: var(--accent); }
.site-nav ul { list-style: none; display: flex; gap: 4px; }
.site-nav a {
  font-size: .85rem;
  font-weight: 500;
  color: var(--muted);
  padding: 6px 14px;
  border-radius: 8px;
  transition: background .18s, color .18s;
}
.site-nav a:hover { background: var(--bg); color: var(--primary); }

/* === HERO === */
.site-hero {
  background: linear-gradient(135deg, #0f172a 0%, #1a2f5a 55%, #1d4ed8 100%);
  color: #fff;
  text-align: center;
  padding: 80px 24px 68px;
  position: relative;
  overflow: hidden;
}
.site-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero-inner { position: relative; }
.site-hero h1 {
  font-size: clamp(2.2rem, 6vw, 3.5rem);
  font-weight: 900;
  letter-spacing: -1.5px;
  margin-bottom: 14px;
  line-height: 1.1;
}
.site-hero h1 span { color: #60a5fa; }
.hero-tagline { font-size: 1.1rem; color: #94a3b8; max-width: 520px; margin: 0 auto; }
.hero-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-top: 36px;
  padding-top: 28px;
  border-top: 1px solid rgba(255,255,255,.1);
}
.hero-stat-num { font-size: 1.6rem; font-weight: 800; color: #fff; }
.hero-stat-label { font-size: .75rem; color: #64748b; text-transform: uppercase; letter-spacing: .5px; margin-top: 2px; }

/* === LAYOUT === */
.container { max-width: 1200px; margin: 0 auto; padding: 0 28px; }
.posts-section { padding: 52px 0 24px; }

.section-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
}
.section-title {
  font-size: .8rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  white-space: nowrap;
}
.section-line { flex: 1; height: 1px; background: var(--border); }

/* === POST GRID === */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

/* Featured first post */
.posts-grid .post-card:first-child {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.posts-grid .post-card:first-child .post-card-thumb,
.posts-grid .post-card:first-child .post-card-thumb-placeholder { height: 100%; min-height: 260px; }
.posts-grid .post-card:first-child .post-card-title { font-size: 1.5rem; }
.posts-grid .post-card:first-child .post-card-excerpt { -webkit-line-clamp: 5; }

/* === POST CARD === */
.post-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease;
  display: flex;
  flex-direction: column;
}
.post-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }

.post-card-thumb {
  width: 100%;
  height: 210px;
  object-fit: cover;
  background: var(--border);
}
.post-card-thumb-placeholder {
  width: 100%;
  height: 210px;
  background: linear-gradient(135deg, #1e3a8a, #4f46e5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}

.post-card-body {
  padding: 20px 22px 22px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.post-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: .75rem;
  color: var(--muted);
}
.cat-badge {
  background: #eff6ff;
  color: var(--accent);
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.post-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.4;
  margin-bottom: 10px;
}
.post-card-title a { color: inherit; transition: color .15s; }
.post-card-title a:hover { color: var(--accent); }
.post-card-excerpt {
  font-size: .875rem;
  color: var(--muted);
  line-height: 1.65;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.read-more {
  font-size: .8rem;
  font-weight: 600;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: gap .18s;
}
.read-more:hover { gap: 8px; color: var(--accent-dark); }

/* === PAGINATION === */
.posts-pagination { padding: 40px 0 60px; display: flex; justify-content: center; }
.posts-pagination .nav-links { display: flex; gap: 6px; align-items: center; }
.posts-pagination a,
.posts-pagination .current {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: .875rem;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.posts-pagination a { background: var(--card); color: var(--accent); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.posts-pagination a:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.posts-pagination .current { background: var(--accent); color: #fff; }

/* === SINGLE POST === */
.single-back { max-width: 760px; margin: 32px auto 0; padding: 0 24px; }
.single-back a {
  font-size: .85rem;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color .15s;
}
.single-back a:hover { color: var(--accent); }

.single-wrap { max-width: 760px; margin: 28px auto 60px; padding: 0 24px; }

.single-cat { margin-bottom: 14px; }
.single-cat a {
  background: #eff6ff;
  color: var(--accent);
  font-size: .76rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.single-title {
  font-size: clamp(1.6rem, 5vw, 2.5rem);
  font-weight: 900;
  color: var(--primary);
  line-height: 1.22;
  letter-spacing: -0.8px;
  margin-bottom: 18px;
}
.single-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: .85rem;
  margin-bottom: 28px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}
.single-meta .sep { opacity: .35; }

/* === POST CONTENT === */
.post-content { font-size: 1.05rem; line-height: 1.85; color: var(--text); }
.post-content p { margin-bottom: 1.5em; }
.post-content h2, .post-content h3, .post-content h4 {
  font-weight: 700; color: var(--primary);
  margin: 2em 0 .75em; line-height: 1.3;
}
.post-content h2 { font-size: 1.55rem; }
.post-content h3 { font-size: 1.25rem; }
.post-content h4 { font-size: 1.05rem; }
.post-content a { color: var(--accent); border-bottom: 1px solid #bfdbfe; transition: border-color .15s; }
.post-content a:hover { border-bottom-color: var(--accent); }
.post-content img {
  border-radius: var(--radius);
  margin: 1.8em 0;
  box-shadow: var(--shadow-sm);
  width: 100% !important;
  height: auto !important;
}
.post-content ul, .post-content ol { margin: 1em 0 1.5em 1.6em; }
.post-content li { margin-bottom: .5em; }
.post-content blockquote {
  border-left: 4px solid var(--accent);
  background: #eff6ff;
  padding: 18px 22px;
  border-radius: 0 10px 10px 0;
  margin: 1.8em 0;
  color: var(--muted);
  font-style: italic;
}

/* Ad wrapper spacing */
.post-content .ai-viewports,
.post-content [class*="ai-"] { margin: 2.2em 0 !important; }

/* === FOOTER === */
.site-footer {
  background: var(--primary);
  color: #475569;
  padding: 44px 28px;
  text-align: center;
}
.footer-logo { font-size: 1.4rem; font-weight: 900; color: #f1f5f9; margin-bottom: 6px; }
.footer-logo span { color: #60a5fa; }
.footer-copy { font-size: .78rem; }

/* === IMAGE FALLBACK === */
.post-card-thumb-fallback { object-fit: cover; }

/* Hide alt text on broken images before onerror fires */
.post-card-thumb { color: transparent; font-size: 0; }

/* Fallback in post content: full-width, object-fit */
.post-content img[src$=".svg"],
.post-content img.img-fallback { object-fit: cover; max-height: 400px; }

/* Prevent 0x0 broken images from collapsing layout */
.post-content img { min-height: 4px; }

/* === RESPONSIVE === */
@media (max-width: 900px) {
  .posts-grid .post-card:first-child {
    grid-template-columns: 1fr;
    grid-column: auto;
  }
  .posts-grid .post-card:first-child .post-card-thumb,
  .posts-grid .post-card:first-child .post-card-thumb-placeholder { min-height: 210px; }
}
@media (max-width: 640px) {
  .posts-grid { grid-template-columns: 1fr; }
  .hero-stats { gap: 24px; }
  .single-wrap, .single-back { padding: 0 16px; }
  .header-inner { padding: 0 16px; }
  .container { padding: 0 16px; }
}
