/* -----------------------------------------------------------------
   style.css - Responsive, mobile-first cho toàn bộ website blog
   ----------------------------------------------------------------- */

:root {
    --color-primary: #1a56db;
    --color-text: #1f2937;
    --color-muted: #6b7280;
    --color-border: #e5e7eb;
    --color-bg: #ffffff;
    --color-bg-alt: #f9fafb;
    --max-width: 1100px;
    --radius: 8px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--color-text);
    background: var(--color-bg-alt);
    line-height: 1.6;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 16px;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Header ===== */
.site-header {
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
}
.site-logo { font-size: 1.3rem; font-weight: 700; color: var(--color-text); }
.main-nav a { margin-left: 16px; color: var(--color-text); font-weight: 500; }

/* ===== Breadcrumb ===== */
.breadcrumb { background: var(--color-bg); border-bottom: 1px solid var(--color-border); font-size: 0.85rem; }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 10px 0; }
.breadcrumb li:not(:last-child)::after { content: "›"; margin-left: 6px; color: var(--color-muted); }
.breadcrumb span[aria-current] { color: var(--color-muted); }

/* ===== Main ===== */
.site-main { padding: 32px 16px; min-height: 60vh; }
.page-title { font-size: 1.8rem; margin-bottom: 24px; }

/* ===== Post grid / cards ===== */
.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
}
.post-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.post-card-thumb { width: 100%; aspect-ratio: 16/9; object-fit: cover; background: var(--color-bg-alt); }
.post-card-link { color: inherit; }
.post-card-link:hover { text-decoration: none; }
.post-card-title { font-size: 1.05rem; margin: 12px 14px 0; }
.post-card-excerpt { font-size: 0.9rem; color: var(--color-muted); margin: 8px 14px; flex-grow: 1; }
.post-card-meta { font-size: 0.8rem; color: var(--color-muted); margin: 0 14px 14px; display: flex; justify-content: space-between; }
.post-card-category { background: var(--color-bg-alt); padding: 2px 8px; border-radius: 999px; }

/* ===== Post detail ===== */
.post-title { font-size: 2rem; margin-bottom: 8px; line-height: 1.3; }
.post-meta { color: var(--color-muted); font-size: 0.9rem; margin-bottom: 20px; display: flex; gap: 16px; flex-wrap: wrap; }
.post-thumbnail { margin: 0 0 24px; }
.post-thumbnail img { border-radius: var(--radius); }
.post-content { font-size: 1.05rem; }
.post-content h2 { margin-top: 32px; }
.post-content img { border-radius: var(--radius); margin: 16px 0; }
.post-tags { margin-top: 24px; }
.post-tags .tag {
    display: inline-block;
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    margin-right: 6px;
}

.related-posts { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--color-border); }

/* ===== Pagination ===== */
.pagination { display: flex; gap: 8px; margin-top: 32px; flex-wrap: wrap; }
.pagination a, .pagination .current {
    padding: 8px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-bg);
}
.pagination .current { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* ===== 404 ===== */
.error-404 { text-align: center; padding: 60px 0; }
.error-404 h1 { font-size: 2.2rem; }

/* ===== Footer ===== */
.site-footer { background: var(--color-bg); border-top: 1px solid var(--color-border); padding: 20px 0; text-align: center; color: var(--color-muted); font-size: 0.9rem; }

/* ===== Responsive ===== */
@media (max-width: 640px) {
    .post-title { font-size: 1.5rem; }
    .header-inner { flex-direction: column; gap: 8px; align-items: flex-start; }
    .post-grid { grid-template-columns: 1fr; }
}
