/* ═══════════════════════════════════════════════════════════
   Bitnova Blog — Master Stylesheet
   ═══════════════════════════════════════════════════════════ */

/* ─── GOOGLE FONTS ──────────────────────────────────────────
   Loaded via <link> in head.php:
   - Clash Display  (headings)
   - DM Mono        (code, tags, meta)
   - Instrument Sans (body)
─────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img { display: block; max-width: 100%; }
a  { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

/* ─── THEME TOKENS ───────────────────────────────────────── */
:root {
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --r-sm: 6px; --r-md: 10px; --r-lg: 16px; --r-xl: 22px;
}

[data-theme="dark"] {
    --bg:         #09090e;
    --bg-s:       #0f0f17;
    --bg-e:       #16161f;
    --bg-h:       #1d1d28;
    --bd:         rgba(255,255,255,0.06);
    --bd-s:       rgba(255,255,255,0.11);
    --tx:         #e8e8f0;
    --tx-2:       #9090a8;
    --tx-3:       #50506a;
    --ac:         #7b78f8;
    --ac-t:       #b0adff;
    --ac-bg:      rgba(123,120,248,0.12);
    --ac-bd:      rgba(123,120,248,0.28);
    --gn:         #2dd4a0;
    --am:         #f0a050;
    --re:         #f87171;
    --hero-rad:   radial-gradient(ellipse 55% 65% at 68% 40%, rgba(123,120,248,0.14), transparent);
}

[data-theme="light"] {
    --bg:         #f5f5f8;
    --bg-s:       #ffffff;
    --bg-e:       #eeeef4;
    --bg-h:       #e5e5ef;
    --bd:         rgba(0,0,0,0.07);
    --bd-s:       rgba(0,0,0,0.13);
    --tx:         #111118;
    --tx-2:       #52526a;
    --tx-3:       #9898b0;
    --ac:         #5552d6;
    --ac-t:       #5552d6;
    --ac-bg:      rgba(85,82,214,0.07);
    --ac-bd:      rgba(85,82,214,0.22);
    --gn:         #0a9e72;
    --am:         #c97c1a;
    --re:         #dc2626;
    --hero-rad:   radial-gradient(ellipse 55% 65% at 68% 40%, rgba(85,82,214,0.07), transparent);
}

/* ─── BASE ───────────────────────────────────────────────── */
html { scroll-behavior: smooth; }
body {
    font-family: 'Instrument Sans', 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--tx);
    font-size: 16px;
    line-height: 1.65;
    min-height: 100vh;
    transition: background .3s var(--ease), color .3s var(--ease);
}
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-thumb { background: var(--bd-s); border-radius: 3px; }

/* ─── NAV ────────────────────────────────────────────────── */
.nav {
    position: sticky; top: 0; z-index: 200;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 5vw; height: 62px;
    background: var(--bg);
    border-bottom: 1px solid var(--bd);
    backdrop-filter: blur(18px);
    transition: background .3s;
}
.nav-logo {
    display: flex; align-items: center; gap: 9px;
    font-family: 'DM Mono', monospace; font-size: 15px; font-weight: 500;
    letter-spacing: -.01em; color: var(--tx);
}
.logo-icon {
    width: 30px; height: 30px; border-radius: 8px;
    background: var(--ac); display: flex; align-items: center;
    justify-content: center; font-size: 13px; font-weight: 700; color: #fff;
}
.nav-links { display: flex; gap: 26px; list-style: none; }
.nav-links a { font-size: 13.5px; color: var(--tx-2); transition: color .2s; }
.nav-links a:hover, .nav-links a.active { color: var(--tx); }
.nav-right { display: flex; align-items: center; gap: 10px; }
.btn-icon {
    width: 36px; height: 36px; border-radius: var(--r-sm);
    background: var(--bg-e); border: 1px solid var(--bd);
    display: flex; align-items: center; justify-content: center;
    color: var(--tx-2); font-size: 14px; transition: background .2s, color .2s;
}
.btn-icon:hover { background: var(--bg-h); color: var(--tx); }
.btn-primary {
    padding: 8px 18px; background: var(--ac); color: #fff;
    border-radius: var(--r-sm); font-size: 13px; font-weight: 500;
    transition: opacity .2s, transform .15s;
}
.btn-primary:hover { opacity: .86; transform: translateY(-1px); }
.btn-ghost {
    padding: 8px 16px; border: 1px solid var(--bd-s);
    border-radius: var(--r-sm); font-size: 13px; color: var(--tx-2);
    transition: background .2s, color .2s;
}
.btn-ghost:hover { background: var(--bg-e); color: var(--tx); }

/* Search bar */
.search-wrap {
    display: flex; align-items: center; gap: 7px;
    background: var(--bg-e); border: 1px solid var(--bd);
    border-radius: var(--r-sm); padding: 0 11px; height: 36px;
    transition: border-color .2s;
}
.search-wrap:focus-within { border-color: var(--ac); }
.search-wrap svg { opacity: .45; flex-shrink: 0; }
.search-wrap input {
    background: none; border: none; outline: none;
    font-size: 13px; color: var(--tx); font-family: inherit; width: 150px;
}
.search-wrap input::placeholder { color: var(--tx-3); }

/* ─── HERO ───────────────────────────────────────────────── */
.hero {
    padding: 72px 5vw 64px; position: relative; overflow: hidden;
    border-bottom: 1px solid var(--bd);
}
.hero::before { content: ''; position: absolute; inset: 0; background: var(--hero-rad); pointer-events: none; }
.hero-inner { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 52px; align-items: center; position: relative; }
.hero-pill {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 4px 13px; background: var(--ac-bg); border: 1px solid var(--ac-bd);
    border-radius: 20px; font-family: 'DM Mono', monospace; font-size: 11px;
    color: var(--ac-t); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 18px;
}
.hero-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--ac-t); }
.hero-title {
    font-family: 'Clash Display', 'Sora', sans-serif;
    font-size: clamp(30px, 3.8vw, 50px); font-weight: 700;
    line-height: 1.12; letter-spacing: -.025em; color: var(--tx); margin-bottom: 18px;
}
.hero-title em { font-style: normal; color: var(--ac-t); }
.hero-desc { font-size: 15.5px; color: var(--tx-2); line-height: 1.7; max-width: 480px; margin-bottom: 28px; }
.hero-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.hero-img {
    border-radius: var(--r-xl); overflow: hidden;
    aspect-ratio: 16/10; background: var(--bg-e);
    border: 1px solid var(--bd-s); position: relative;
}
.hero-img img { width: 100%; height: 100%; object-fit: cover; filter: brightness(.88); transition: transform .5s var(--ease); }
.hero-img:hover img { transform: scale(1.04); }
.hero-badge {
    position: absolute; bottom: 12px; left: 12px;
    padding: 5px 12px; background: rgba(9,9,14,.7); backdrop-filter: blur(8px);
    border-radius: 20px; font-size: 11.5px; font-family: 'DM Mono', monospace;
    color: #fff; border: 1px solid rgba(255,255,255,.1);
}
.hero-meta { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.avatar {
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-weight: 500; color: #fff; flex-shrink: 0; font-size: 11px;
}
.avatar-sm { width: 30px; height: 30px; }
.avatar-md { width: 38px; height: 38px; }
.hero-author-name { font-size: 13px; font-weight: 500; }
.hero-author-date { font-size: 11.5px; color: var(--tx-3); }
.pill {
    padding: 4px 11px; border-radius: 20px;
    font-size: 11px; font-family: 'DM Mono', monospace; font-weight: 500;
}
.pill-ac   { background: var(--ac-bg);              color: var(--ac-t); border: 1px solid var(--ac-bd); }
.pill-gn   { background: rgba(45,212,160,.1);        color: var(--gn); }
.pill-am   { background: rgba(240,160,80,.1);         color: var(--am); }
.pill-mute { background: var(--bg-e); border: 1px solid var(--bd); color: var(--tx-2); }

/* ─── FILTER BAR ─────────────────────────────────────────── */
.filter-bar {
    position: sticky; top: 62px; z-index: 90;
    background: var(--bg); border-bottom: 1px solid var(--bd);
    padding: 18px 5vw;
}
.filter-inner {
    max-width: 1200px; margin: 0 auto;
    display: flex; align-items: center; gap: 7px;
    overflow-x: auto; scrollbar-width: none;
}
.filter-inner::-webkit-scrollbar { display: none; }
.filter-lbl { font-size: 11.5px; font-family: 'DM Mono', monospace; color: var(--tx-3); white-space: nowrap; margin-right: 4px; }
.filter-btn {
    padding: 5px 14px; border-radius: 20px; border: 1px solid var(--bd);
    background: var(--bg-e); font-size: 12.5px; font-weight: 500;
    color: var(--tx-2); white-space: nowrap; transition: all .2s var(--ease);
}
.filter-btn:hover, .filter-btn.active { background: var(--ac); border-color: var(--ac); color: #fff; }

/* ─── LAYOUT ─────────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 5vw; }
.main-grid { display: grid; grid-template-columns: 1fr 310px; gap: 52px; padding: 52px 0 80px; align-items: start; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 26px; }
.section-lbl { font-size: 11.5px; font-family: 'DM Mono', monospace; color: var(--tx-3); text-transform: uppercase; letter-spacing: .08em; }
.see-all { font-size: 12.5px; color: var(--ac-t); display: flex; align-items: center; gap: 4px; transition: gap .2s; }
.see-all:hover { gap: 7px; }

/* ─── POST GRID ──────────────────────────────────────────── */
.posts-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.card {
    background: var(--bg-s); border: 1px solid var(--bd);
    border-radius: var(--r-lg); overflow: hidden;
    transition: transform .25s var(--ease), border-color .25s, box-shadow .25s;
}
.card:hover { transform: translateY(-3px); border-color: var(--bd-s); box-shadow: 0 14px 44px rgba(0,0,0,.16); }
.card.wide { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; }
.card-img { overflow: hidden; background: var(--bg-e); }
.card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s var(--ease); }
.card:hover .card-img img { transform: scale(1.05); }
.card .card-img { aspect-ratio: 16/9; }
.card.wide .card-img { aspect-ratio: auto; min-height: 220px; }
.card-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 9px; }
.card-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.card-title {
    font-size: 15.5px; font-weight: 600; color: var(--tx);
    line-height: 1.4; letter-spacing: -.01em; transition: color .2s;
}
.card.wide .card-title { font-size: 19px; }
.card:hover .card-title { color: var(--ac-t); }
.card-excerpt { font-size: 13px; color: var(--tx-2); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--bd); }
.card-author { display: flex; align-items: center; gap: 7px; }
.card-author-name { font-size: 12px; color: var(--tx-2); }
.card-meta { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--tx-3); display: flex; gap: 8px; }

/* ─── SIDEBAR ────────────────────────────────────────────── */
.sidebar { display: flex; flex-direction: column; gap: 28px; }
.widget { background: var(--bg-s); border: 1px solid var(--bd); border-radius: var(--r-lg); padding: 20px; }
.widget-title { font-size: 11px; font-family: 'DM Mono', monospace; color: var(--tx-3); text-transform: uppercase; letter-spacing: .1em; margin-bottom: 14px; }

/* Newsletter */
.nl-desc { font-size: 13px; color: var(--tx-2); line-height: 1.6; margin-bottom: 12px; }
.nl-form { display: flex; flex-direction: column; gap: 7px; }
.nl-input {
    padding: 9px 13px; background: var(--bg-e); border: 1px solid var(--bd);
    border-radius: var(--r-sm); font-size: 13px; color: var(--tx);
    font-family: inherit; outline: none; transition: border-color .2s;
}
.nl-input::placeholder { color: var(--tx-3); }
.nl-input:focus { border-color: var(--ac); }
.nl-btn { padding: 9px; background: var(--ac); color: #fff; border-radius: var(--r-sm); font-size: 13px; font-weight: 500; font-family: inherit; transition: opacity .2s; }
.nl-btn:hover { opacity: .86; }
.nl-note { font-size: 11px; color: var(--tx-3); text-align: center; }

/* Trending */
.trend-list { display: flex; flex-direction: column; gap: 13px; }
.trend-item { display: flex; align-items: flex-start; gap: 11px; cursor: pointer; transition: opacity .2s; }
.trend-item:hover { opacity: .75; }
.trend-n { font-family: 'DM Mono', monospace; font-size: 19px; font-weight: 500; color: var(--bd-s); min-width: 22px; line-height: 1.3; }
.trend-t { font-size: 13px; font-weight: 500; color: var(--tx); line-height: 1.45; }
.trend-m { font-size: 11px; color: var(--tx-3); font-family: 'DM Mono', monospace; margin-top: 3px; }

/* Tags cloud */
.tags-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-item { padding: 5px 11px; border: 1px solid var(--bd); border-radius: 20px; font-size: 12px; color: var(--tx-2); cursor: pointer; transition: all .2s; }
.tag-item:hover { background: var(--ac-bg); border-color: var(--ac); color: var(--ac-t); }

/* ─── POST PAGE ──────────────────────────────────────────── */
.post-wrap { max-width: 740px; margin: 0 auto; padding: 52px 5vw 80px; }
.back-link { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--tx-2); margin-bottom: 36px; transition: color .2s, gap .2s; }
.back-link:hover { color: var(--tx); gap: 10px; }
.post-title {
    font-family: 'Clash Display', 'Sora', sans-serif;
    font-size: clamp(26px, 4vw, 42px); font-weight: 700;
    line-height: 1.13; letter-spacing: -.025em; color: var(--tx); margin: 14px 0 18px;
}
.post-meta-bar {
    display: flex; align-items: center; gap: 16px;
    padding: 14px 0; border-top: 1px solid var(--bd); border-bottom: 1px solid var(--bd); margin-bottom: 32px;
}
.post-meta-name { font-size: 14px; font-weight: 500; }
.post-meta-date { font-size: 11.5px; color: var(--tx-3); font-family: 'DM Mono', monospace; }
.post-meta-right { margin-left: auto; display: flex; gap: 14px; font-size: 11.5px; font-family: 'DM Mono', monospace; color: var(--tx-3); }
.post-hero-img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: var(--r-xl); border: 1px solid var(--bd); margin-bottom: 36px; }

/* Article content */
.post-content { font-size: 17px; line-height: 1.82; }
.post-content h2 { font-family: 'Instrument Sans', sans-serif; font-size: 22px; font-weight: 600; margin: 38px 0 14px; color: var(--tx); }
.post-content h3 { font-size: 18px; font-weight: 600; margin: 28px 0 10px; color: var(--tx); }
.post-content p { margin-bottom: 18px; color: var(--tx-2); }
.post-content p:first-of-type { color: var(--tx); font-size: 18px; }
.post-content a { color: var(--ac-t); border-bottom: 1px solid var(--ac-bd); }
.post-content pre {
    background: var(--bg-e); border: 1px solid var(--bd); border-radius: var(--r-md);
    padding: 18px 20px; overflow-x: auto; margin: 22px 0;
    font-family: 'DM Mono', monospace; font-size: 13.5px; line-height: 1.7; color: var(--ac-t);
}
.post-content code {
    font-family: 'DM Mono', monospace; font-size: 13.5px;
    color: var(--ac-t); background: var(--ac-bg); padding: 2px 6px; border-radius: 4px;
}
.post-content pre code { background: none; padding: 0; color: inherit; }
.post-content blockquote {
    border-left: 3px solid var(--ac); padding-left: 20px;
    margin: 26px 0; color: var(--tx-2); font-style: italic;
}
.post-content ul, .post-content ol { padding-left: 22px; margin-bottom: 18px; }
.post-content li { margin-bottom: 7px; color: var(--tx-2); }
.post-content img { border-radius: var(--r-md); margin: 22px 0; }

/* Comments */
.comments { margin-top: 60px; padding-top: 36px; border-top: 1px solid var(--bd); }
.comments-title { font-size: 18px; font-weight: 600; margin-bottom: 24px; }
.c-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 36px; }
.c-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.c-input {
    padding: 10px 13px; background: var(--bg-s); border: 1px solid var(--bd);
    border-radius: var(--r-sm); font-size: 14px; color: var(--tx);
    font-family: inherit; outline: none; transition: border-color .2s;
}
.c-input::placeholder { color: var(--tx-3); }
.c-input:focus { border-color: var(--ac); }
textarea.c-input { min-height: 95px; resize: vertical; }
.c-submit { padding: 10px 22px; background: var(--ac); color: #fff; border-radius: var(--r-sm); font-size: 14px; font-weight: 500; font-family: inherit; align-self: flex-start; transition: opacity .2s; }
.c-submit:hover { opacity: .86; }
.c-list { display: flex; flex-direction: column; gap: 16px; }
.c-item { background: var(--bg-s); border: 1px solid var(--bd); border-radius: var(--r-md); padding: 16px 18px; }
.c-head { display: flex; align-items: center; gap: 9px; margin-bottom: 9px; }
.c-name { font-size: 13.5px; font-weight: 500; }
.c-date { font-size: 11px; color: var(--tx-3); font-family: 'DM Mono', monospace; }
.c-body { font-size: 14px; color: var(--tx-2); line-height: 1.65; }

/* ─── ADMIN ──────────────────────────────────────────────── */
.admin-layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.admin-sidebar {
    background: var(--bg-s); border-right: 1px solid var(--bd);
    padding: 24px 0; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.admin-logo { padding: 0 20px 20px; border-bottom: 1px solid var(--bd); margin-bottom: 12px; }
.admin-logo a { font-family: 'DM Mono', monospace; font-size: 14px; font-weight: 500; color: var(--tx); }
.admin-nav a {
    display: flex; align-items: center; gap: 10px; padding: 10px 20px;
    font-size: 13.5px; color: var(--tx-2); transition: background .2s, color .2s;
}
.admin-nav a:hover, .admin-nav a.active { background: var(--bg-e); color: var(--tx); }
.admin-nav a .nav-icon { width: 16px; height: 16px; opacity: .6; }
.admin-main { padding: 36px 40px; background: var(--bg); }
.admin-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 32px; }
.admin-page-title { font-size: 22px; font-weight: 600; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 32px; }
.stat-card { background: var(--bg-s); border: 1px solid var(--bd); border-radius: var(--r-lg); padding: 18px; }
.stat-lbl { font-size: 11.5px; font-family: 'DM Mono', monospace; color: var(--tx-3); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 8px; }
.stat-val { font-size: 28px; font-weight: 600; color: var(--tx); }
.stat-delta { font-size: 12px; margin-top: 4px; }
.stat-delta.up { color: var(--gn); }
.stat-delta.dn { color: var(--re); }

/* Admin table */
.table-wrap { background: var(--bg-s); border: 1px solid var(--bd); border-radius: var(--r-lg); overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th { padding: 12px 16px; text-align: left; font-size: 11px; font-family: 'DM Mono', monospace; text-transform: uppercase; letter-spacing: .07em; color: var(--tx-3); border-bottom: 1px solid var(--bd); }
.data-table td { padding: 13px 16px; border-bottom: 1px solid var(--bd); color: var(--tx-2); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-e); }
.status-badge { padding: 3px 9px; border-radius: 20px; font-size: 11px; font-family: 'DM Mono', monospace; font-weight: 500; }
.status-published { background: rgba(45,212,160,.12); color: var(--gn); }
.status-draft     { background: var(--bg-e); color: var(--tx-3); border: 1px solid var(--bd); }
.status-pending   { background: rgba(240,160,80,.12); color: var(--am); }
.status-approved  { background: rgba(45,212,160,.12); color: var(--gn); }
.status-spam      { background: rgba(248,113,113,.12); color: var(--re); }
.tbl-actions { display: flex; gap: 8px; }
.act-btn { padding: 4px 10px; border-radius: var(--r-sm); border: 1px solid var(--bd); font-size: 12px; color: var(--tx-2); transition: all .2s; }
.act-btn:hover { background: var(--bg-e); }
.act-btn.danger { color: var(--re); border-color: rgba(248,113,113,.3); }
.act-btn.danger:hover { background: rgba(248,113,113,.08); }

/* Admin form */
.form-card { background: var(--bg-s); border: 1px solid var(--bd); border-radius: var(--r-lg); padding: 28px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-label { font-size: 12.5px; font-weight: 500; color: var(--tx-2); }
.form-input {
    padding: 10px 13px; background: var(--bg-e); border: 1px solid var(--bd);
    border-radius: var(--r-sm); font-size: 14px; color: var(--tx);
    font-family: inherit; outline: none; transition: border-color .2s;
}
.form-input::placeholder { color: var(--tx-3); }
.form-input:focus { border-color: var(--ac); }
select.form-input { appearance: none; cursor: pointer; }
textarea.form-input { min-height: 300px; resize: vertical; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }

/* Flash messages */
.flash { padding: 12px 16px; border-radius: var(--r-md); font-size: 13.5px; margin-bottom: 22px; display: flex; align-items: center; gap: 8px; }
.flash-success { background: rgba(45,212,160,.1); border: 1px solid rgba(45,212,160,.25); color: var(--gn); }
.flash-error   { background: rgba(248,113,113,.1); border: 1px solid rgba(248,113,113,.25); color: var(--re); }
.flash-info    { background: var(--ac-bg); border: 1px solid var(--ac-bd); color: var(--ac-t); }

/* Pagination */
.pagination { display: flex; align-items: center; gap: 6px; margin-top: 36px; justify-content: center; }
.page-btn { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: var(--r-sm); border: 1px solid var(--bd); font-size: 13px; color: var(--tx-2); transition: all .2s; }
.page-btn:hover, .page-btn.active { background: var(--ac); border-color: var(--ac); color: #fff; }
.page-btn.disabled { opacity: .4; pointer-events: none; }

/* ─── FOOTER ─────────────────────────────────────────────── */
footer { border-top: 1px solid var(--bd); padding: 36px 5vw; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.footer-logo { font-family: 'DM Mono', monospace; font-size: 13.5px; color: var(--tx-2); }
.footer-logo strong { color: var(--tx); }
.footer-links { display: flex; gap: 18px; }
.footer-links a { font-size: 12.5px; color: var(--tx-3); transition: color .2s; }
.footer-links a:hover { color: var(--tx); }
.footer-copy { font-size: 12px; color: var(--tx-3); }

/* ─── ANIMATIONS ─────────────────────────────────────────── */
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
.anim { animation: fadeUp .45s var(--ease) both; }
.a1 { animation-delay: .04s; } .a2 { animation-delay: .1s; } .a3 { animation-delay: .16s; } .a4 { animation-delay: .22s; }

/* ─── MOBILE ─────────────────────────────────────────────── */
.hamburger { display: none; }
.mobile-menu { display: none; position: fixed; top: 62px; left: 0; right: 0; background: var(--bg); border-bottom: 1px solid var(--bd); padding: 16px 5vw; flex-direction: column; gap: 4px; z-index: 99; }
.mobile-menu.open { display: flex; }
.mobile-menu a { padding: 10px 12px; border-radius: var(--r-sm); font-size: 14px; color: var(--tx-2); transition: background .2s; }
.mobile-menu a:hover { background: var(--bg-e); color: var(--tx); }

@media (max-width: 960px) {
    .main-grid { grid-template-columns: 1fr; }
    .sidebar { display: grid; grid-template-columns: repeat(2, 1fr); }
    .hero-inner { grid-template-columns: 1fr; }
    .hero-img { display: none; }
    .admin-layout { grid-template-columns: 1fr; }
    .admin-sidebar { display: none; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .nav-links, .btn-primary, .search-wrap { display: none; }
    .hamburger { display: flex; }
    .posts-grid { grid-template-columns: 1fr; }
    .card.wide { grid-template-columns: 1fr; }
    .card.wide .card-img { min-height: 180px; }
    .sidebar { grid-template-columns: 1fr; }
    .c-row { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ═══════════════════════════════════════════════════════════
   POST PAGE — ENHANCED FEATURES
   ═══════════════════════════════════════════════════════════ */

/* ── Reading progress bar ────────────────────────────────── */
.reading-progress {
    position: fixed; top: 0; left: 0; right: 0;
    height: 3px; z-index: 999; background: transparent;
}
.reading-progress-fill {
    height: 100%; background: var(--ac);
    width: 0%; transition: width .1s linear;
    border-radius: 0 2px 2px 0;
}

/* ── Breadcrumb ──────────────────────────────────────────── */
.breadcrumb {
    display: flex; align-items: center; gap: 6px;
    font-size: 12.5px; font-family: 'DM Mono', monospace;
    color: var(--tx-3); margin-bottom: 24px; flex-wrap: wrap;
}
.breadcrumb a { color: var(--tx-3); transition: color .2s; }
.breadcrumb a:hover { color: var(--ac-t); }
.breadcrumb-sep { color: var(--bd-s); }

/* ── Hero image — enhanced ───────────────────────────────── */
.post-hero-wrap {
    position: relative; margin-bottom: 40px;
    border-radius: var(--r-xl); overflow: hidden;
    aspect-ratio: 16/9; background: var(--bg-e);
    border: 1px solid var(--bd);
}
.post-hero-wrap img {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
}
.post-hero-caption {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 48px 20px 16px;
    background: linear-gradient(to top, rgba(0,0,0,.6), transparent);
    font-size: 12px; color: rgba(255,255,255,.7);
    font-family: 'DM Mono', monospace;
}

/* ── Share bar ───────────────────────────────────────────── */
.share-bar {
    display: flex; align-items: center; gap: 8px;
    padding: 16px 0; border-top: 1px solid var(--bd);
    border-bottom: 1px solid var(--bd); margin: 32px 0;
    flex-wrap: wrap;
}
.share-label {
    font-size: 12px; font-family: 'DM Mono', monospace;
    color: var(--tx-3); text-transform: uppercase; letter-spacing: .07em;
    margin-right: 4px;
}
.share-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px; border-radius: 20px; font-size: 12.5px;
    font-weight: 500; transition: all .2s; border: 1px solid var(--bd);
    background: var(--bg-e); color: var(--tx-2); cursor: pointer;
    font-family: 'Instrument Sans', sans-serif;
}
.share-btn:hover { background: var(--bg-h); color: var(--tx); border-color: var(--bd-s); }
.share-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.share-btn.copied { background: rgba(45,212,160,.1); border-color: rgba(45,212,160,.3); color: var(--gn); }

/* ── Table of contents ───────────────────────────────────── */
.toc-wrap {
    background: var(--bg-s); border: 1px solid var(--bd);
    border-left: 3px solid var(--ac); border-radius: 0 var(--r-md) var(--r-md) 0;
    padding: 18px 20px; margin: 0 0 36px;
}
.toc-title {
    font-size: 11px; font-family: 'DM Mono', monospace;
    text-transform: uppercase; letter-spacing: .1em;
    color: var(--tx-3); margin-bottom: 12px;
}
.toc-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.toc-list a {
    font-size: 13.5px; color: var(--tx-2);
    transition: color .2s; display: block; padding: 2px 0;
    border-bottom: none;
}
.toc-list a:hover { color: var(--ac-t); }
.toc-list a.toc-h3 { padding-left: 16px; font-size: 12.5px; color: var(--tx-3); }
.toc-list a.toc-active { color: var(--ac-t); }

/* ── Author card ─────────────────────────────────────────── */
.author-card {
    display: flex; gap: 18px; align-items: flex-start;
    background: var(--bg-s); border: 1px solid var(--bd);
    border-radius: var(--r-lg); padding: 22px; margin-top: 52px;
}
.author-card .avatar { width: 56px; height: 56px; font-size: 16px; flex-shrink: 0; }
.author-card-body { flex: 1; }
.author-card-name { font-size: 15px; font-weight: 600; color: var(--tx); margin-bottom: 6px; }
.author-card-role {
    font-size: 11px; font-family: 'DM Mono', monospace;
    color: var(--ac-t); text-transform: uppercase;
    letter-spacing: .07em; margin-bottom: 8px;
}
.author-card-bio { font-size: 13.5px; color: var(--tx-2); line-height: 1.65; }
.author-card-posts { font-size: 12px; color: var(--tx-3); margin-top: 8px; font-family: 'DM Mono', monospace; }

/* ── Post stats bar ──────────────────────────────────────── */
.post-stats {
    display: flex; gap: 20px; align-items: center;
    padding: 12px 0; flex-wrap: wrap;
}
.post-stat {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; font-family: 'DM Mono', monospace; color: var(--tx-3);
}
.post-stat svg { width: 13px; height: 13px; opacity: .6; }

/* ── Sticky TOC sidebar (wide screens) ──────────────────── */
.post-layout {
    max-width: 1100px; margin: 0 auto; padding: 52px 5vw 80px;
    display: grid; grid-template-columns: 1fr 240px; gap: 56px; align-items: start;
}
.post-main { min-width: 0; }
.post-sidebar { position: sticky; top: 90px; display: flex; flex-direction: column; gap: 20px; }
.sidebar-toc { background: var(--bg-s); border: 1px solid var(--bd); border-radius: var(--r-lg); padding: 18px 20px; }
.sidebar-toc .toc-title { margin-bottom: 10px; }
.sidebar-toc .toc-list a { font-size: 12.5px; }

/* ── Like / Bookmark buttons ─────────────────────────────── */
.post-actions {
    display: flex; gap: 10px; align-items: center; margin-top: 32px;
}
.action-btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 18px; border-radius: 20px;
    border: 1px solid var(--bd); background: var(--bg-e);
    font-size: 13px; color: var(--tx-2); cursor: pointer;
    transition: all .2s; font-family: inherit;
}
.action-btn:hover { background: var(--bg-h); color: var(--tx); }
.action-btn.liked    { background: rgba(248,113,113,.1); border-color: rgba(248,113,113,.3); color: var(--re); }
.action-btn.bookmarked { background: var(--ac-bg); border-color: var(--ac-bd); color: var(--ac-t); }
.action-btn svg { width: 15px; height: 15px; }

/* ── Prev / Next post navigation ────────────────────────── */
.post-nav {
    display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
    margin-top: 52px; padding-top: 36px; border-top: 1px solid var(--bd);
}
.post-nav-item {
    background: var(--bg-s); border: 1px solid var(--bd);
    border-radius: var(--r-lg); padding: 16px 18px;
    display: flex; flex-direction: column; gap: 6px;
    transition: border-color .2s, transform .2s;
    text-decoration: none; cursor: pointer;
}
.post-nav-item:hover { border-color: var(--bd-s); transform: translateY(-2px); }
.post-nav-item.next { text-align: right; }
.post-nav-dir {
    font-size: 11px; font-family: 'DM Mono', monospace;
    color: var(--tx-3); text-transform: uppercase; letter-spacing: .07em;
}
.post-nav-title { font-size: 13.5px; font-weight: 500; color: var(--tx); line-height: 1.4; }
.post-nav-item.empty { pointer-events: none; background: transparent; border: 1px dashed var(--bd); }

/* ── Responsive post layout ─────────────────────────────── */
@media (max-width: 900px) {
    .post-layout { grid-template-columns: 1fr; }
    .post-sidebar { display: none; }
    .toc-wrap { display: block; }
}
@media (max-width: 900px) and (min-width: 1px) {
    .post-nav { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════
   POST PAGE — Extended components
   ═══════════════════════════════════════════════════════════ */

/* ── Featured image (full-bleed above post wrap) ─────────── */
.post-featured-img-wrap {
    width: 100%;
    max-height: 520px;
    overflow: hidden;
    position: relative;
    background: var(--bg-e);
}
.post-featured-img {
    width: 100%;
    height: 100%;
    max-height: 520px;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform .5s var(--ease);
}
.post-featured-img-wrap:hover .post-featured-img {
    transform: scale(1.015);
}
.post-img-caption {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 10px 20px;
    background: linear-gradient(to top, rgba(0,0,0,.65), transparent);
    font-size: 12px;
    color: rgba(255,255,255,.8);
    font-style: italic;
    text-align: center;
}

/* ── Breadcrumbs ─────────────────────────────────────────── */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    font-size: 12.5px;
    color: var(--tx-3);
}
.breadcrumbs a {
    color: var(--tx-3);
    transition: color .2s;
}
.breadcrumbs a:hover { color: var(--ac-t); }
.bc-sep   { color: var(--tx-3); opacity: .5; }
.bc-current { color: var(--tx-2); }

/* ── Share buttons ───────────────────────────────────────── */
.share-btns {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    flex-shrink: 0;
}
.share-btn {
    width: 32px; height: 32px;
    border-radius: var(--r-sm);
    border: 1px solid var(--bd);
    background: var(--bg-e);
    display: flex; align-items: center; justify-content: center;
    color: var(--tx-2);
    cursor: pointer;
    transition: all .2s var(--ease);
    text-decoration: none;
    font-family: inherit;
}
.share-btn:hover { background: var(--bg-h); color: var(--tx); border-color: var(--bd-s); transform: translateY(-1px); }
.share-x:hover  { color: #000; background: #fff; }
.share-li:hover { color: #fff; background: #0a66c2; border-color: #0a66c2; }

/* ── Author bio card ─────────────────────────────────────── */
.author-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-top: 48px;
    padding: 24px;
    background: var(--bg-s);
    border: 1px solid var(--bd);
    border-radius: var(--r-lg);
}
.author-card-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--tx);
}
.author-card-bio {
    font-size: 13.5px;
    color: var(--tx-2);
    line-height: 1.6;
    margin-top: 6px;
}
.author-social-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-family: 'DM Mono', monospace;
    color: var(--ac-t);
    padding: 3px 9px;
    border: 1px solid var(--ac-bd);
    border-radius: 20px;
    background: var(--ac-bg);
    transition: opacity .2s;
}
.author-social-link:hover { opacity: .78; }

/* ── Prev / Next navigation ──────────────────────────────── */
.post-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 40px;
    padding-top: 32px;
    border-top: 1px solid var(--bd);
}
.post-nav-link {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 16px 18px;
    background: var(--bg-s);
    border: 1px solid var(--bd);
    border-radius: var(--r-md);
    transition: border-color .2s, transform .2s;
    text-decoration: none;
}
.post-nav-link:hover { border-color: var(--bd-s); transform: translateY(-2px); }
.post-nav-next { text-align: right; }
.post-nav-label {
    font-size: 11px;
    font-family: 'DM Mono', monospace;
    color: var(--tx-3);
    text-transform: uppercase;
    letter-spacing: .07em;
}
.post-nav-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--tx);
    line-height: 1.4;
}

/* ── Related posts section ───────────────────────────────── */
.related-posts   { margin-top: 52px; }
.related-title   {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--tx);
    padding-bottom: 12px;
    border-bottom: 1px solid var(--bd);
}

/* ── Tags row ────────────────────────────────────────────── */
.post-tags-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
}

/* ── SEO panel in admin editor ───────────────────────────── */
.seo-score-bar {
    height: 4px;
    border-radius: 2px;
    background: var(--bg-e);
    margin-top: 10px;
    overflow: hidden;
}
.seo-score-fill {
    height: 100%;
    border-radius: 2px;
    transition: width .4s, background .4s;
}
.seo-check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12.5px;
    color: var(--tx-2);
    padding: 5px 0;
    border-bottom: 1px solid var(--bd);
}
.seo-check:last-child { border-bottom: none; }
.seo-check-icon { flex-shrink: 0; font-size: 13px; margin-top: 1px; }

/* ── Character counters ──────────────────────────────────── */
.char-count {
    font-size: 11px;
    font-family: 'DM Mono', monospace;
    color: var(--tx-3);
    text-align: right;
    margin-top: 3px;
    transition: color .2s;
}
.char-count.warn  { color: var(--am); }
.char-count.error { color: var(--re); }

/* ── Image upload zone ───────────────────────────────────── */
.img-upload-zone {
    border: 2px dashed var(--bd-s);
    border-radius: var(--r-md);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    position: relative;
}
.img-upload-zone:hover,
.img-upload-zone.drag-over {
    border-color: var(--ac);
    background: var(--ac-bg);
}
.img-upload-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}
.img-preview {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    border-radius: var(--r-md);
    margin-bottom: 10px;
    border: 1px solid var(--bd);
}
.img-remove-btn {
    font-size: 12px;
    color: var(--re);
    background: rgba(248,113,113,.1);
    border: 1px solid rgba(248,113,113,.25);
    border-radius: var(--r-sm);
    padding: 4px 10px;
    cursor: pointer;
    transition: background .2s;
}
.img-remove-btn:hover { background: rgba(248,113,113,.18); }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 640px) {
    .post-meta-bar { flex-wrap: wrap; gap: 12px; }
    .share-btns    { margin-left: 0; }
    .post-nav      { grid-template-columns: 1fr; }
    .author-card   { flex-direction: column; }
    .post-featured-img-wrap { max-height: 260px; }
}
