/* ═══════════════════════════════════════════════════════════
   BLOG — light theme, minimal, modern. Dùng cho mọi trang /blog/*
   (trang chủ vẫn dark; blog cố ý đổi tông sáng để đọc dài dễ hơn)
═══════════════════════════════════════════════════════════ */
:root {
    --font: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

    --bg: #fafaf9;          /* nền trang — trắng ngà rất nhẹ */
    --surface: #ffffff;     /* card, hộp */
    --ink: #1c1917;         /* chữ chính */
    --ink-2: #57534e;       /* chữ phụ */
    --ink-3: #a8a29e;       /* meta, placeholder */
    --line: #e7e5e4;        /* hairline */
    --line-2: #f5f5f4;      /* hairline nhạt hơn */
    --accent: #0e7490;      /* cyan-700 — cùng họ với #00f2ff ở trang chủ nhưng đủ đậm trên nền sáng */
    --accent-soft: #ecfeff;

    --r-xl: 28px;           /* ảnh cover, featured */
    --r-lg: 20px;           /* card, ảnh trong bài */
    --r-md: 14px;           /* hộp nhỏ, nút */
    --r-pill: 999px;

    --wrap: 1120px;
    --measure: 680px;       /* bề rộng cột đọc */
    --shadow-sm: 0 1px 2px rgba(28, 25, 23, .04), 0 1px 3px rgba(28, 25, 23, .04);
    --shadow-md: 0 10px 30px -12px rgba(28, 25, 23, .18);
    --ease: cubic-bezier(.2, .7, .2, 1);
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body.blog {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
h1, h2, h3, h4 { font-family: var(--font); font-weight: 700; letter-spacing: -.02em; line-height: 1.2; margin: 0; }
p { margin: 0; }
button { font: inherit; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 24px; }
@media (min-width: 768px) { .wrap { padding-inline: 40px; } }

.skip {
    position: absolute; left: -999px; top: 12px; z-index: 100;
    background: var(--ink); color: #fff; padding: 8px 14px; border-radius: var(--r-pill);
}
.skip:focus { left: 12px; }

/* ─── NAV ───────────────────────────────────────────────── */
.site-nav {
    position: sticky; top: 0; z-index: 50;
    background: rgba(250, 250, 249, .86);
    border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.brand img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); }
.brand-sep { color: var(--ink-3); font-weight: 400; }
.brand-sub { color: var(--ink-2); font-weight: 500; }
.nav-links { display: flex; gap: 4px; }
.nav-links a {
    font-size: 14px; font-weight: 500; color: var(--ink-2);
    padding: 8px 12px; border-radius: var(--r-pill);
    transition: color .2s var(--ease), background-color .2s var(--ease);
}
.nav-links a:hover { color: var(--ink); background: var(--line-2); }
.brand, .nav-links a { white-space: nowrap; }
@media (max-width: 480px) {
    .brand-sep, .brand-sub { display: none; }
    .nav-links a { padding: 8px 10px; font-size: 13.5px; }
    .nav-links a[href="/blog/"] { display: none; }   /* logo đã trỏ về /blog/ */
}

/* ─── HERO LISTING ──────────────────────────────────────── */
.blog-hero { padding-top: 64px; padding-bottom: 28px; }
@media (min-width: 768px) { .blog-hero { padding-top: 88px; padding-bottom: 36px; } }
.blog-hero h1 { font-size: clamp(40px, 7vw, 64px); font-weight: 800; letter-spacing: -.035em; }
.blog-intro { margin-top: 14px; font-size: 18px; color: var(--ink-2); max-width: 560px; line-height: 1.6; }
@media (min-width: 768px) { .blog-intro { font-size: 20px; } }

.cat-nav { display: flex; gap: 8px; flex-wrap: nowrap; overflow-x: auto; margin-top: 28px; padding-bottom: 4px; scrollbar-width: none; }
.cat-nav::-webkit-scrollbar { display: none; }

/* ─── PILLS / META ─────────────────────────────────────── */
.pill {
    display: inline-flex; align-items: center; white-space: nowrap;
    font-size: 12px; font-weight: 600; letter-spacing: .02em;
    padding: 5px 11px; border-radius: var(--r-pill);
    background: var(--accent-soft); color: var(--accent);
    transition: background-color .2s var(--ease), color .2s var(--ease);
}
.pill:hover { background: var(--accent); color: #fff; }
.pill--nav {
    font-size: 14px; font-weight: 500; padding: 8px 16px;
    background: var(--surface); color: var(--ink-2); border: 1px solid var(--line);
}
.pill--nav:hover { border-color: var(--ink-3); color: var(--ink); background: var(--surface); }
.pill--nav.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }

.meta { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-3); flex-wrap: wrap; }
.meta time { color: var(--ink-2); }
.meta .dot { color: var(--line); }

/* ─── CARDS ─────────────────────────────────────────────── */
.listing { padding-bottom: 72px; }
.card-grid {
    display: grid; grid-template-columns: 1fr; gap: 36px 28px;
}
@media (min-width: 640px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .card-grid { grid-template-columns: repeat(3, 1fr); } }

.card { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card-media {
    position: relative; display: block; overflow: hidden; border-radius: var(--r-lg);
    background: var(--line-2); aspect-ratio: 16 / 10; border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}
.card-media img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform .6s var(--ease);
}
.card:hover .card-media img { transform: scale(1.03); }
.card-media--empty { display: grid; place-items: center; color: var(--ink-3); font-weight: 600; letter-spacing: .1em; text-transform: uppercase; font-size: 12px; }
.card-body { display: flex; flex-direction: column; gap: 10px; }
.card-title { font-size: 20px; line-height: 1.3; }
.card-title a { background-image: linear-gradient(currentColor, currentColor); background-size: 0 1.5px; background-repeat: no-repeat; background-position: 0 100%; transition: background-size .35s var(--ease); }
.card:hover .card-title a { background-size: 100% 1.5px; }
.card-excerpt { color: var(--ink-2); font-size: 15px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* bài mới nhất — to, nằm riêng phía trên lưới */
.card--featured { margin-bottom: 48px; gap: 22px; }
.card--featured .card-media { border-radius: var(--r-xl); aspect-ratio: 16 / 9; }
.card--featured .card-title { font-size: clamp(26px, 4vw, 40px); letter-spacing: -.025em; max-width: 20ch; }
.card--featured .card-excerpt { font-size: 17px; max-width: 60ch; -webkit-line-clamp: 3; }
@media (min-width: 900px) {
    .card--featured { display: grid; grid-template-columns: 1.35fr 1fr; align-items: center; gap: 40px; }
    .card--featured .card-body { gap: 14px; }
}
.empty { color: var(--ink-3); padding: 48px 0; text-align: center; }

.pagination { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--line); }
.page-info { font-size: 13px; color: var(--ink-3); }
.page-btn { font-size: 14px; font-weight: 500; padding: 9px 16px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface); transition: border-color .2s; }
.page-btn:hover { border-color: var(--ink-3); }
.page-btn[aria-disabled="true"] { opacity: .35; pointer-events: none; }

/* ─── POST ──────────────────────────────────────────────── */
.read-progress {
    position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 60;
    background: var(--accent); transform-origin: 0 50%; transform: scaleX(0);
}
.post-head { max-width: calc(var(--measure) + 80px); padding-top: 56px; }
@media (min-width: 768px) { .post-head { padding-top: 80px; } }
.post-title { font-size: clamp(32px, 5.5vw, 52px); font-weight: 800; letter-spacing: -.035em; line-height: 1.1; margin-top: 18px; }
.post-lead { margin-top: 18px; font-size: 19px; line-height: 1.55; color: var(--ink-2); }
@media (min-width: 768px) { .post-lead { font-size: 21px; } }
.byline { display: flex; align-items: center; gap: 12px; margin-top: 28px; }
.byline img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); }
.byline div { display: flex; flex-direction: column; line-height: 1.3; }
.byline-name { font-size: 14px; font-weight: 600; }
.byline-role { font-size: 12.5px; color: var(--ink-3); }

.post-cover { margin: 40px auto 0; max-width: 1000px; }
.post-cover img {
    width: 100%; border-radius: var(--r-xl); aspect-ratio: 16 / 10; object-fit: cover;
    border: 1px solid var(--line); box-shadow: var(--shadow-md);
}
.post-cover figcaption { margin-top: 12px; font-size: 13px; color: var(--ink-3); text-align: center; }

/* nội dung bài — cột đọc 680px */
.post-body { max-width: calc(var(--measure) + 80px); padding-top: 48px; font-size: 17.5px; line-height: 1.8; color: var(--ink); }
@media (min-width: 768px) { .post-body { font-size: 18.5px; padding-top: 56px; } }
.post-body > * + * { margin-top: 1.25em; }
.post-body h2 { font-size: 1.55em; margin-top: 2em; line-height: 1.25; }
.post-body h3 { font-size: 1.2em; margin-top: 1.75em; }
.post-body h2 + *, .post-body h3 + * { margin-top: .75em; }
.post-body p { margin-bottom: 0; }
.post-body a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: rgba(14, 116, 144, .4); }
.post-body a:hover { text-decoration-color: currentColor; }
.post-body strong { font-weight: 700; }
.post-body ul, .post-body ol { padding-left: 1.4em; }
.post-body li + li { margin-top: .4em; }
.post-body li::marker { color: var(--ink-3); }
.post-body blockquote {
    margin: 1.75em 0; padding: 4px 0 4px 22px; border-left: 3px solid var(--ink);
    font-size: 1.08em; color: var(--ink-2);
}
.post-body blockquote p + p { margin-top: .75em; }
.post-body figure { margin: 2em 0; }
.post-body img { border-radius: var(--r-lg); border: 1px solid var(--line); width: 100%; }
.post-body figcaption { margin-top: 10px; font-size: 13.5px; color: var(--ink-3); text-align: center; }
.post-body hr { border: 0; height: 1px; background: var(--line); margin: 2.5em auto; width: 80px; }
.post-body code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em; background: var(--line-2); padding: .15em .4em; border-radius: 6px; }
.post-body pre { background: #1c1917; color: #f5f5f4; padding: 18px 20px; border-radius: var(--r-md); overflow-x: auto; font-size: 14px; line-height: 1.6; }
.post-body pre code { background: none; padding: 0; color: inherit; font-size: inherit; }
.post-body table { width: 100%; border-collapse: collapse; font-size: .92em; }
.post-body th, .post-body td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.post-body th { font-weight: 600; color: var(--ink-2); font-size: .85em; letter-spacing: .03em; text-transform: uppercase; }
.post-body .table-wrap, .post-body pre { max-width: 100%; }
.post-body iframe { width: 100%; border-radius: var(--r-lg); border: 1px solid var(--line); }

/* cuối bài */
.post-foot { max-width: calc(var(--measure) + 80px); padding-top: 40px; display: flex; flex-direction: column; gap: 36px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { font-size: 13px; color: var(--ink-2); background: var(--line-2); padding: 5px 11px; border-radius: var(--r-pill); }
.share { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding-top: 28px; border-top: 1px solid var(--line); }
.share-label { font-size: 13px; color: var(--ink-3); margin-right: 6px; }
.btn {
    display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
    font-size: 14px; font-weight: 500; color: var(--ink);
    padding: 9px 16px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface);
    transition: border-color .2s var(--ease), background-color .2s var(--ease), color .2s var(--ease);
}
.btn:hover { border-color: var(--ink-3); }
.btn.is-done { background: var(--ink); color: #fff; border-color: var(--ink); }

.author-box {
    display: flex; gap: 18px; align-items: flex-start;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
    padding: 22px; box-shadow: var(--shadow-sm);
}
.author-box img { width: 72px; height: 72px; border-radius: 18px; object-fit: cover; flex: none; border: 1px solid var(--line); }
.author-name { font-weight: 700; font-size: 16px; }
.author-bio { margin-top: 6px; font-size: 14.5px; color: var(--ink-2); line-height: 1.6; }
.author-links { margin-top: 12px; display: flex; gap: 16px; font-size: 14px; font-weight: 500; }
.author-links a { color: var(--accent); }
@media (max-width: 480px) { .author-box { flex-direction: column; } }

.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.nav-card {
    display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; min-width: 0;
    border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface);
    transition: border-color .2s var(--ease), transform .3s var(--ease);
}
.nav-card:hover { border-color: var(--ink-3); transform: translateY(-2px); }
.nav-card--empty { border: 0; background: none; pointer-events: none; }
.nav-card:last-child { text-align: right; }
.nav-card-label { font-size: 12px; color: var(--ink-3); letter-spacing: .04em; text-transform: uppercase; }
.nav-card-title { font-weight: 600; font-size: 15px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 480px) {
    .post-nav { grid-template-columns: 1fr; }
    .nav-card:last-child { text-align: left; }
    .nav-card--empty { display: none; }
}

.related { padding-top: 64px; padding-bottom: 80px; margin-top: 56px; border-top: 1px solid var(--line); }
.section-title { font-size: 22px; margin-bottom: 28px; letter-spacing: -.02em; }

/* ─── FOOTER ───────────────────────────────────────────── */
.site-foot { border-top: 1px solid var(--line); padding: 32px 0 36px; font-size: 13.5px; color: var(--ink-3); }
.site-foot strong { color: var(--ink-2); font-weight: 600; }
.foot-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.foot-links { display: flex; gap: 18px; flex-wrap: wrap; }
.foot-links a { color: var(--ink-2); transition: color .2s; }
.foot-links a:hover { color: var(--ink); }

/* ─── DESKTOP CÓ CHUỘT: bật hiệu ứng mờ nền nav (theo nguyên tắc README) ── */
@media (hover: hover) and (pointer: fine) and (min-width: 1025px) {
    .site-nav { backdrop-filter: saturate(160%) blur(12px); -webkit-backdrop-filter: saturate(160%) blur(12px); }
}

::selection { background: #cffafe; color: var(--ink); }
