:root {
    --primary:  #1f6feb;
    --accent:   #58a6ff;
    --text:     #e6edf3;
    --muted:    #8b949e;
    --border:   #30363d;
    --bg:       #0d1117;
    --card-bg:  #161b22;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 15px;
}

a { color: var(--accent); }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ── Header ──────────────────────────── */
.site-header { background: #010409; color: #fff; padding: 18px 0 0; }

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding-bottom: 14px;
}

.site-branding { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.site-name     { font-size: 22px; font-weight: bold; color: #fff; text-decoration: none; }
.site-tagline  { font-size: 13px; color: rgba(255,255,255,.55); }

.site-search { display: flex; gap: 6px; }
.site-search input  { padding: 6px 12px; border: 1px solid var(--border); border-radius: 4px; font-size: 14px; width: 180px; background: #161b22; color: var(--text); }
.site-search input::placeholder { color: var(--muted); }
.site-search button { padding: 6px 14px; background: var(--primary); color: #fff; border: none; border-radius: 4px; cursor: pointer; font-size: 13px; }
.site-search button:hover { background: #388bfd; }

.site-nav { background: rgba(255,255,255,.04); border-top: 1px solid var(--border); }
.site-nav .container { display: flex; gap: 2px; flex-wrap: wrap; padding-top: 0; padding-bottom: 0; }
.site-nav a { color: rgba(255,255,255,.72); text-decoration: none; padding: 9px 14px; font-size: 13.5px; transition: background .12s; }
.site-nav a:hover, .site-nav a.active { color: #fff; background: rgba(255,255,255,.08); }

/* ── Main ────────────────────────────── */
.main-content { padding: 28px 20px 40px; }

/* ── Archive heading ─────────────────── */
.archive-title {
    font-size: 18px;
    margin: 0 0 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border);
    color: var(--text);
}
.archive-title a { color: inherit; text-decoration: none; }
.archive-title a:hover { color: var(--accent); }

/* ── Card grid ───────────────────────── */
.card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

@media (max-width: 900px)  { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px)  { .card-grid { grid-template-columns: 1fr; } }

.grid-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow .15s, transform .15s;
}
.grid-card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,.5);
    transform: translateY(-2px);
}

.grid-card-img-wrap { display: block; overflow: hidden; aspect-ratio: 16/10; background: #21262d; }
.grid-card-img      { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.grid-card-img-wrap:hover .grid-card-img { transform: scale(1.03); }
.grid-card-no-img   { aspect-ratio: 16/10; background: var(--border); }

.grid-card-body { padding: 14px 16px 16px; flex: 1; display: flex; flex-direction: column; }

.grid-card h2 { margin: 0 0 6px; font-size: 16px; line-height: 1.35; }
.grid-card h2 a { color: var(--text); text-decoration: none; }
.grid-card h2 a:hover { color: var(--accent); }

.post-meta { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.post-meta a { color: var(--muted); text-decoration: none; }
.post-meta a:hover { color: var(--accent); }
.breadcrumb-sep { margin: 0 3px; opacity: .4; }

.grid-excerpt { font-size: 13px; color: var(--muted); margin: 0 0 10px; flex: 1; }

/* ── Tags ────────────────────────────── */
.post-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: auto; padding-top: 8px; }
.tag {
    display: inline-block;
    padding: 2px 9px;
    background: #1c2a3a;
    color: #58a6ff;
    border-radius: 20px;
    font-size: 11px;
    text-decoration: none;
    transition: background .12s;
    border: 1px solid #2d4a68;
}
.tag:hover { background: #243a52; color: #79b8ff; }

/* ── Single post ─────────────────────── */
.single-post {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 32px 36px;
    max-width: 780px;
    margin: 0 auto;
}
.featured-img { width: 100%; border-radius: 6px; margin-bottom: 24px; display: block; }
.post-title   { margin: 0 0 12px; font-size: 28px; line-height: 1.25; }

.post-content { font-size: 15px; line-height: 1.85; }
.post-content h2, .post-content h3 { color: #cdd9e5; }
.post-content img  { max-width: 100%; height: auto; border-radius: 4px; }
.post-content pre  { background: #0d1117; border: 1px solid var(--border); padding: 16px; border-radius: 5px; overflow-x: auto; font-size: 13px; color: var(--text); }
.post-content code { background: #1c2938; padding: 2px 6px; border-radius: 3px; font-size: .9em; color: #f0883e; }
.post-content pre code { background: transparent; color: var(--text); }
.post-content blockquote { border-left: 4px solid var(--accent); margin: 0; padding: 8px 20px; color: var(--muted); font-style: italic; background: rgba(88,166,255,.05); }
.post-content table { border-collapse: collapse; width: 100%; }
.post-content th, .post-content td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.post-content th { background: #1c2938; color: #cdd9e5; }
.post-content td { background: var(--card-bg); }

.back-link { display: inline-block; margin-top: 28px; color: var(--accent); font-size: 14px; text-decoration: none; }
.back-link:hover { text-decoration: underline; }

/* ── Series ──────────────────────────── */
.series-box {
    background: #161f2e;
    border: 1px solid #2d4a68;
    border-left: 4px solid var(--accent);
    border-radius: 6px;
    padding: 18px 20px;
    margin: 28px 0;
}
.series-label { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--accent); font-weight: bold; margin-bottom: 4px; }
.series-title { font-size: 15px; font-weight: bold; margin-bottom: 12px; }
.series-title a { color: #79b8ff; text-decoration: none; }
.series-title a:hover { text-decoration: underline; }
.series-parts { margin: 0 0 12px; padding-left: 22px; }
.series-parts li { margin-bottom: 5px; font-size: 14px; }
.series-part a { color: var(--accent); text-decoration: none; }
.series-part a:hover { text-decoration: underline; }
.series-part-current { color: var(--text); }
.series-part-placeholder { color: #484f58; }
.series-coming-soon { color: #484f58; font-style: italic; }
.series-badge-soon { font-size: 10px; background: #21262d; color: #8b949e; padding: 1px 6px; border-radius: 8px; margin-left: 6px; font-style: normal; vertical-align: middle; border: 1px solid var(--border); }
.series-nav { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid #2d4a68; }
.series-nav-btn { font-size: 13px; color: var(--accent); text-decoration: none; }
.series-nav-btn:hover { text-decoration: underline; }
.series-page h1 { font-size: 26px; margin-bottom: 8px; }
.series-description { color: var(--muted); margin-bottom: 20px; }
.series-excerpt { font-size: 13px; color: var(--muted); margin: 3px 0 0; }

/* ── Pagination ──────────────────────── */
.pagination { display: flex; gap: 5px; padding: 24px 0 32px; flex-wrap: wrap; }
.pagination a {
    display: inline-block;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    background: var(--card-bg);
    text-decoration: none;
    font-size: 13.5px;
}
.pagination a:hover, .pagination a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── 404 ─────────────────────────────── */
.not-found { text-align: center; padding: 60px 0; }
.not-found h1 { font-size: 28px; }

/* ── Footer ──────────────────────────── */
.site-footer {
    background: #010409;
    color: rgba(255,255,255,.35);
    text-align: center;
    padding: 18px;
    font-size: 13px;
    border-top: 1px solid var(--border);
}

@media (max-width: 600px) {
    .single-post { padding: 20px; }
    .post-title  { font-size: 22px; }
    .header-inner { flex-direction: column; align-items: flex-start; }
}
