/**
 * DGTH theme — CSS mobile-first.
 *
 * QUY TẮC: mọi khai báo mặc định (không media query) LÀ giao diện điện thoại.
 * Media query chỉ dùng `min-width` để MỞ RỘNG cho tablet/desktop — không bao
 * giờ dựng desktop trước rồi dùng `max-width` co lại.
 *
 * Lý do không phải sở thích: phần lớn lưu lượng của site là điện thoại, và
 * dữ liệu Search Console cho thấy mobile xếp hạng tốt hơn desktop 22 bậc —
 * mobile là bản gốc, desktop là bản mở rộng.
 */

:root {
    --dgth-text: #1a1a1a;
    --dgth-muted: #5c5c5c;
    --dgth-line: #e3e3e3;
    --dgth-accent: #0a5c36;
    --dgth-accent-soft: #f0f7f3;
    --dgth-bg: #fff;

    --dgth-gap: 16px;
    --dgth-radius: 8px;
    --dgth-max: 1180px;
    --dgth-max-narrow: 760px;
}

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

body {
    margin: 0;
    color: var(--dgth-text);
    background: var(--dgth-bg);
    font-size: 16px;
    line-height: 1.65;
    -webkit-text-size-adjust: 100%;
}

img { max-width: 100%; height: auto; }
a { color: var(--dgth-accent); }

.dgth-skip {
    position: absolute;
    left: -9999px;
}
.dgth-skip:focus {
    left: 8px;
    top: 8px;
    z-index: 100;
    background: #fff;
    padding: 8px 12px;
}

/* --- Bố cục ---------------------------------------------------------- */

.dgth-container {
    width: 100%;
    max-width: var(--dgth-max);
    margin: 0 auto;
    padding: var(--dgth-gap);
}

.dgth-container--narrow { max-width: var(--dgth-max-narrow); }

/* --- Header ---------------------------------------------------------- */

.dgth-header {
    border-bottom: 1px solid var(--dgth-line);
    position: sticky;
    top: 0;
    background: var(--dgth-bg);
    z-index: 20;
}

.dgth-header__bar {
    max-width: var(--dgth-max);
    margin: 0 auto;
    padding: 10px var(--dgth-gap);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.dgth-logo {
    font-weight: 700;
    font-size: 18px;
    text-decoration: none;
    color: var(--dgth-text);
}

/* Menu bằng checkbox — không cần JS, hoạt động cả khi script lỗi. */
.dgth-nav-button {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;   /* vùng chạm tối thiểu */
    cursor: pointer;
    padding: 10px;
}
.dgth-nav-button span {
    display: block;
    height: 2px;
    background: var(--dgth-text);
}

.dgth-nav {
    display: none;
    width: 100%;
}
.dgth-nav-toggle:checked ~ .dgth-nav { display: block; }

.dgth-nav__list {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
}
.dgth-nav__list a {
    display: block;
    padding: 11px 4px;   /* 40px+ chiều cao chạm */
    text-decoration: none;
    color: var(--dgth-text);
    border-bottom: 1px solid var(--dgth-line);
}

/* --- Danh sách bài --------------------------------------------------- */

.dgth-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

.dgth-card-post__link { text-decoration: none; color: inherit; }

.dgth-card-post__img {
    width: 100%;
    border-radius: var(--dgth-radius);
    display: block;
}

.dgth-card-post__title {
    font-size: 18px;
    line-height: 1.35;
    margin: 10px 0 6px;
}

.dgth-card-post__excerpt {
    margin: 0 0 8px;
    color: var(--dgth-muted);
    font-size: 15px;
}

/* --- Bài viết -------------------------------------------------------- */

.dgth-article__title {
    font-size: 26px;
    line-height: 1.25;
    margin: 0 0 8px;
}

.dgth-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    font-size: 13px;
    color: var(--dgth-muted);
    margin-bottom: 12px;
}

.dgth-meta__item--verified {
    color: var(--dgth-accent);
    font-weight: 600;
}

.dgth-article__body > * { max-width: 100%; }

.dgth-article__body h2 { font-size: 21px; margin-top: 1.8em; }
.dgth-article__body h3 { font-size: 18px; margin-top: 1.5em; }

/*
 * Bảng dữ liệu dài BẮT BUỘC có phương án mobile. Ở đây: cuộn ngang trong
 * khung riêng, không để tràn ra ngoài làm vỡ layout toàn trang.
 *
 * Bảng so sánh trong bài toplist phải là <table> HTML thật, KHÔNG được chụp
 * ảnh — AI search đọc được bảng, không đọc được ảnh.
 */
.dgth-article__body table {
    display: block;
    width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    font-size: 14px;
    -webkit-overflow-scrolling: touch;
}

.dgth-article__body th,
.dgth-article__body td {
    border: 1px solid var(--dgth-line);
    padding: 8px 10px;
    text-align: left;
    vertical-align: top;
}

.dgth-article__body th { background: var(--dgth-accent-soft); }

/* --- Breadcrumb & phân trang ----------------------------------------- */

.dgth-breadcrumb {
    font-size: 13px;
    color: var(--dgth-muted);
    margin-bottom: 10px;
}

.dgth-container .nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 28px;
}
.dgth-container .nav-links .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 40px;
    padding: 0 10px;
    border: 1px solid var(--dgth-line);
    border-radius: 6px;
    text-decoration: none;
}
.dgth-container .nav-links .current {
    background: var(--dgth-accent);
    color: #fff;
    border-color: var(--dgth-accent);
}

/* --- Form ------------------------------------------------------------ */

input[type="text"],
input[type="search"],
input[type="email"],
textarea,
select {
    width: 100%;
    min-height: 40px;
    font-size: 15px;   /* >= 15px: iOS Safari không tự phóng to khi focus */
    padding: 8px 10px;
    border: 1px solid var(--dgth-line);
    border-radius: 6px;
}

/* --- Footer ---------------------------------------------------------- */

.dgth-footer {
    border-top: 1px solid var(--dgth-line);
    margin-top: 48px;
    padding: 24px var(--dgth-gap);
    background: var(--dgth-accent-soft);
}

.dgth-footer__inner {
    max-width: var(--dgth-max);
    margin: 0 auto;
}

.dgth-footer__list {
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 20px;
}
.dgth-footer__list a {
    display: inline-block;
    padding: 8px 0;
}

.dgth-footer__note {
    font-size: 13px;
    color: var(--dgth-muted);
    margin: 0;
}

/* ===================================================================== */
/* MỞ RỘNG cho màn hình lớn — chỉ dùng min-width, không bao giờ max-width */
/* ===================================================================== */

@media (min-width: 720px) {
    .dgth-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dgth-article__title { font-size: 32px; }
}

@media (min-width: 1024px) {
    .dgth-nav-button { display: none; }

    .dgth-nav {
        display: block;
        width: auto;
    }

    .dgth-nav__list {
        display: flex;
        gap: 4px;
        margin: 0;
    }
    .dgth-nav__list a {
        border-bottom: none;
        padding: 8px 12px;
    }

    .dgth-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

    .dgth-article__body table { display: table; }
}
