/* =========================================================
   Blog cá nhân — giao diện public
   Xây trên Bootstrap 5.3, dùng biến CSS để hỗ trợ light/dark
   ========================================================= */

/* ---------------------------------------------------------
   Bảng màu thương hiệu — lấy trực tiếp từ logo "Cà Phê & Code"
     nâu cà phê  #4e2e1d  (thân cốc, chữ "Cà Phê")
     teal        #2f8189  (chữ "Code", chấm mạch điện)
     caramel     #d8a86c  (khói, lớp crema)
   --------------------------------------------------------- */
:root {
    --blog-radius: 14px;
    --blog-max-content: 68ch;

    --brand-coffee: #4e2e1d;
    --brand-coffee-soft: #6b4430;
    --brand-teal: #2f8189;
    --brand-teal-dark: #256a72;
    --brand-teal-darker: #1d5259;
    --brand-caramel: #d8a86c;
    --brand-caramel-dark: #b4854a;
    --brand-cream: #fbf7f2;

    /* Ghi đè biến của Bootstrap để toàn site theo tông logo */
    --bs-primary: var(--brand-teal);
    --bs-primary-rgb: 47, 129, 137;
    --bs-primary-bg-subtle: #e3f0f1;
    --bs-primary-border-subtle: #b8dade;
    --bs-primary-text-emphasis: var(--brand-teal-darker);
    --bs-link-color: var(--brand-teal-dark);
    --bs-link-color-rgb: 37, 106, 114;
    --bs-link-hover-color: var(--brand-teal-darker);
    --bs-warning: var(--brand-caramel);
    --bs-warning-rgb: 216, 168, 108;
    --bs-warning-bg-subtle: #f7ead8;
    --bs-warning-border-subtle: #ecd0a8;
}

[data-bs-theme="dark"] {
    /* Trên nền tối cần teal sáng hơn để đủ tương phản */
    --bs-primary: #4fabb5;
    --bs-primary-rgb: 79, 171, 181;
    --bs-primary-bg-subtle: #14343a;
    --bs-primary-border-subtle: #1f5259;
    --bs-primary-text-emphasis: #7ec6ce;
    --bs-link-color: #6cbfc8;
    --bs-link-color-rgb: 108, 191, 200;
    --bs-link-hover-color: #93d3da;
}

/* ---------- Nút / phân trang / form theo màu thương hiệu ---------- */
.btn-primary {
    --bs-btn-bg: var(--brand-teal);
    --bs-btn-border-color: var(--brand-teal);
    --bs-btn-hover-bg: var(--brand-teal-dark);
    --bs-btn-hover-border-color: var(--brand-teal-dark);
    --bs-btn-active-bg: var(--brand-teal-darker);
    --bs-btn-active-border-color: var(--brand-teal-darker);
    --bs-btn-disabled-bg: var(--brand-teal);
    --bs-btn-disabled-border-color: var(--brand-teal);
}

.btn-outline-primary {
    --bs-btn-color: var(--brand-teal-dark);
    --bs-btn-border-color: var(--brand-teal);
    --bs-btn-hover-bg: var(--brand-teal);
    --bs-btn-hover-border-color: var(--brand-teal);
    --bs-btn-active-bg: var(--brand-teal-dark);
    --bs-btn-active-border-color: var(--brand-teal-dark);
}

.pagination {
    --bs-pagination-color: var(--brand-teal-dark);
    --bs-pagination-hover-color: var(--brand-teal-darker);
    --bs-pagination-focus-color: var(--brand-teal-darker);
    --bs-pagination-active-bg: var(--brand-teal);
    --bs-pagination-active-border-color: var(--brand-teal);
}

.dropdown-menu {
    --bs-dropdown-link-active-bg: var(--brand-teal);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--brand-teal);
    box-shadow: 0 0 0 0.2rem rgba(47, 129, 137, 0.2);
}

.form-check-input:checked {
    background-color: var(--brand-teal);
    border-color: var(--brand-teal);
}

.form-check-input:focus {
    border-color: var(--brand-teal);
    box-shadow: 0 0 0 0.2rem rgba(47, 129, 137, 0.2);
}

[data-bs-theme="dark"] .btn-primary {
    --bs-btn-bg: #34929b;
    --bs-btn-border-color: #34929b;
    --bs-btn-hover-bg: #3ba3ad;
    --bs-btn-hover-border-color: #3ba3ad;
}

[data-bs-theme="dark"] .btn-outline-primary {
    --bs-btn-color: #6cbfc8;
    --bs-btn-border-color: #34929b;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "Noto Sans", "Liberation Sans", sans-serif;
    background-color: var(--bs-body-bg);
}

/* ---------- Navbar ---------- */
.site-navbar {
    background-color: rgba(var(--bs-body-bg-rgb), 0.92);
    backdrop-filter: blur(10px);
}

.site-navbar .nav-link.active {
    color: var(--bs-primary);
    font-weight: 600;
}

/* ---------- Logo ---------- */
.brand-mark {
    height: 38px;
    width: auto;
    display: inline-block;
    vertical-align: -0.35rem;
}

.brand-name {
    color: var(--brand-coffee);
    letter-spacing: -0.01em;
}

[data-bs-theme="dark"] .brand-name {
    color: var(--brand-cream);
}

/* Tô sáng chữ "Code" trong tên blog nếu có */
.brand-name .brand-accent {
    color: var(--brand-teal);
}

[data-bs-theme="dark"] .brand-name .brand-accent {
    color: var(--bs-primary);
}

.brand-logo-full {
    max-width: 100%;
    height: auto;
}

/* ---------- Hero ---------- */
.hero {
    background: linear-gradient(135deg,
    rgba(var(--bs-primary-rgb), 0.14),
    rgba(216, 168, 108, 0.16));
    border: 1px solid rgba(var(--bs-primary-rgb), 0.18);
}

.hero h1 {
    color: var(--brand-coffee);
}

[data-bs-theme="dark"] .hero h1 {
    color: var(--brand-cream);
}

.hero-logo {
    max-width: 230px;
    width: 100%;
    height: auto;
    filter: drop-shadow(0 0.5rem 1rem rgba(78, 46, 29, 0.18));
}

.page-header {
    background-color: var(--bs-tertiary-bg);
}

/* ---------- Thẻ bài viết ---------- */
.post-card {
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    overflow: hidden;
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 0.75rem 1.5rem rgba(0, 0, 0, 0.12) !important;
}

.post-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Ảnh thay thế khi bài viết chưa có ảnh bìa */
.post-card-placeholder {
    background: linear-gradient(135deg,
    rgba(var(--bs-primary-rgb), 0.10),
    rgba(216, 168, 108, 0.18));
}

.post-card-placeholder img {
    width: 42%;
    max-width: 110px;
    height: auto;
    opacity: 0.6;
}

.mini-thumb .post-card-placeholder img {
    width: 70%;
    opacity: 0.7;
}

[data-bs-theme="dark"] .post-card-placeholder {
    background: linear-gradient(135deg,
    rgba(var(--bs-primary-rgb), 0.16),
    rgba(216, 168, 108, 0.10));
}

/* Badge chuyên mục dùng màu tự chọn -> thêm viền mảnh để không chìm ở nền tối */
.cat-badge {
    color: #fff !important;
}

[data-bs-theme="dark"] .cat-badge {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}

.category-card {
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 0.75rem 1.5rem rgba(0, 0, 0, 0.12) !important;
}

.mini-thumb img {
    width: 64px;
    height: 64px;
}

.min-w-0 {
    min-width: 0;
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---------- Avatar ---------- */
.avatar-circle {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, var(--brand-teal), var(--brand-coffee));
}

.avatar-circle.avatar-sm {
    width: 40px;
    height: 40px;
    font-size: 1rem;
}

.avatar-circle.avatar-lg {
    width: 96px;
    height: 96px;
    font-size: 2.5rem;
}

/* ---------- Trang chi tiết bài viết ---------- */
.post-cover {
    max-height: 420px;
    object-fit: cover;
}

.post-content {
    font-size: 1.05rem;
    line-height: 1.85;
    word-wrap: break-word;
}

.post-content h2,
.post-content h3,
.post-content h4 {
    margin-top: 2rem;
    margin-bottom: 0.85rem;
    font-weight: 700;
    scroll-margin-top: 5rem;
}

.post-content h2 {
    font-size: 1.6rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.post-content h3 {
    font-size: 1.3rem;
}

.post-content p {
    margin-bottom: 1.15rem;
}

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--blog-radius);
    margin: 1rem 0;
}

.post-content blockquote {
    border-left: 4px solid var(--bs-primary);
    background-color: var(--bs-tertiary-bg);
    padding: 0.85rem 1.15rem;
    margin: 1.25rem 0;
    border-radius: 0 var(--blog-radius) var(--blog-radius) 0;
}

.post-content blockquote p:last-child {
    margin-bottom: 0;
}

.post-content pre {
    background-color: #0d1117;
    color: #e6edf3;
    padding: 1rem 1.15rem;
    border-radius: var(--blog-radius);
    overflow-x: auto;
    margin: 1.25rem 0;
    font-size: 0.9rem;
    position: relative;
}

.post-content pre code {
    background: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

.post-content :not(pre) > code {
    background-color: var(--bs-tertiary-bg);
    color: var(--bs-danger);
    padding: 0.15rem 0.4rem;
    border-radius: 6px;
    font-size: 0.9em;
}

.post-content table {
    width: 100%;
    margin: 1.25rem 0;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.post-content table th,
.post-content table td {
    border: 1px solid var(--bs-border-color);
    padding: 0.55rem 0.75rem;
}

.post-content table th {
    background-color: var(--bs-tertiary-bg);
    font-weight: 600;
    text-align: left;
}

.post-content ul,
.post-content ol {
    margin-bottom: 1.15rem;
    padding-left: 1.5rem;
}

.post-content li {
    margin-bottom: 0.4rem;
}

.post-content hr {
    margin: 2rem 0;
}

/* Nút sao chép trên code block, chèn bằng JS */
.code-copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.1);
    color: #e6edf3;
    opacity: 0;
    transition: opacity 0.15s ease;
    cursor: pointer;
}

.post-content pre:hover .code-copy-btn {
    opacity: 1;
}

/* ---------- Bình luận ---------- */
.comment-body {
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* ---------- Sidebar ---------- */
.sidebar section {
    border-radius: var(--blog-radius);
}

@media (min-width: 992px) {
    .sidebar {
        position: sticky;
        top: 5rem;
    }
}

/* ---------- Footer ---------- */
.site-footer {
    background-color: var(--brand-cream);
    border-top-color: rgba(78, 46, 29, 0.12) !important;
}

[data-bs-theme="dark"] .site-footer {
    background-color: var(--bs-tertiary-bg);
    border-top-color: var(--bs-border-color) !important;
}

/* ---------- Nút lên đầu trang ---------- */
.back-to-top {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1030;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.2);
}

.back-to-top.show {
    display: flex;
}

/* ---------- Trang đăng nhập ---------- */
.login-page {
    background: linear-gradient(135deg,
    rgba(var(--bs-primary-rgb), 0.12),
    var(--bs-body-bg) 60%);
}

/* ---------- Điều chỉnh cho dark mode ---------- */
[data-bs-theme="dark"] .post-content :not(pre) > code {
    color: #ff8a9c;
}

[data-bs-theme="dark"] .badge.text-bg-light {
    background-color: var(--bs-secondary-bg) !important;
    color: var(--bs-body-color) !important;
}

[data-bs-theme="dark"] .post-card:hover,
[data-bs-theme="dark"] .category-card:hover {
    box-shadow: 0 0.75rem 1.5rem rgba(0, 0, 0, 0.45) !important;
}

/* ---------- In ấn ---------- */
@media print {
    .site-navbar,
    .site-footer,
    .sidebar,
    .back-to-top,
    #comments {
        display: none !important;
    }
}

/* ---------- Mục lục bài viết ---------- */
.post-toc {
    background-color: var(--bs-tertiary-bg);
    border-left: 3px solid var(--bs-primary);
    border-radius: 8px;
    padding: 0.85rem 1.1rem;
}

.post-toc summary {
    cursor: pointer;
    list-style: none;
}

.post-toc summary::-webkit-details-marker {
    display: none;
}

.post-toc summary::before {
    content: "\25B8";
    display: inline-block;
    margin-right: 0.4rem;
    transition: transform 0.15s ease;
}

.post-toc details[open] > summary::before {
    transform: rotate(90deg);
}

.post-toc a {
    color: var(--bs-body-color);
    text-decoration: none;
    display: inline-block;
    padding: 0.15rem 0;
}

.post-toc a:hover {
    color: var(--bs-primary);
    text-decoration: underline;
}

.post-toc .toc-sub {
    padding-left: 1.1rem;
    font-size: 0.925em;
}

/* ---------- Sê-ri bài viết ---------- */
.series-bar {
    background-color: var(--bs-tertiary-bg);
    border-radius: 8px;
    padding: 0.75rem 1rem;
}

.series-nav-link {
    border: 1px solid var(--bs-border-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--bs-body-color);
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.series-nav-link:hover {
    border-color: var(--bs-primary);
    background-color: var(--bs-tertiary-bg);
}

/* Tiêu đề có neo: chừa chỗ cho thanh điều hướng dính ở trên khi nhảy từ mục lục */
.post-content :is(h2, h3)[id] {
    scroll-margin-top: 5rem;
}

/* ---------- Nội dung bình luận (Markdown rút gọn) ---------- */
.comment-body > :last-child {
    margin-bottom: 0;
}

.comment-body pre {
    background-color: var(--bs-tertiary-bg);
    border-radius: 6px;
    padding: 0.7rem 0.9rem;
    overflow-x: auto;
    font-size: 0.875em;
}

.comment-body code {
    background-color: var(--bs-tertiary-bg);
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    font-size: 0.875em;
}

.comment-body pre code {
    background: none;
    padding: 0;
}

.comment-body blockquote {
    border-left: 3px solid var(--bs-border-color);
    padding-left: 0.8rem;
    color: var(--bs-secondary-color);
    margin-bottom: 0.5rem;
}

/* ---------- Thanh tiến độ đọc ---------- */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    background: linear-gradient(90deg, var(--bs-primary), #2f8189);
    z-index: 1040;
    transition: width 0.1s linear;
}

/* ---------- Link neo cạnh tiêu đề ---------- */
.post-content :is(h2, h3) .heading-anchor {
    opacity: 0;
    margin-left: 0.35rem;
    font-size: 0.8em;
    color: var(--bs-secondary-color);
    text-decoration: none;
    transition: opacity 0.15s ease;
}

.post-content :is(h2, h3):hover .heading-anchor,
.post-content .heading-anchor:focus {
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    .reading-progress {
        transition: none;
    }
}

/* ---------- Link bỏ qua điều hướng ---------- */
.skip-link {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 1050;
    background-color: var(--bs-body-bg);
    border: 2px solid var(--bs-primary);
    border-radius: 6px;
    padding: 0.5rem 0.9rem;
    text-decoration: none;
    font-weight: 600;
}

/* Nhảy tới nội dung không được vẽ viền quanh cả khối */
main:focus {
    outline: none;
}

/* ---------- Nhãn ngôn ngữ trên khối code ---------- */
.post-content pre.has-code-lang {
    position: relative;
}

.post-content .code-lang {
    position: absolute;
    top: 0;
    right: 0;
    padding: 0.1rem 0.5rem;
    font-size: 0.7rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.65);
    background-color: rgba(255, 255, 255, 0.08);
    border-radius: 0 8px 0 8px;
    user-select: none;
}

/* ---------- Xem ảnh phóng to ---------- */
.post-content img.zoomable {
    cursor: zoom-in;
}

.image-viewer {
    position: fixed;
    inset: 0;
    z-index: 1060;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background-color: rgba(0, 0, 0, 0.85);
}

.image-viewer.open {
    display: flex;
}

.image-viewer img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    background-color: #fff;
}

.image-viewer-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    border: none;
    border-radius: 50%;
    width: 2.5rem;
    height: 2.5rem;
    background-color: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.image-viewer-close:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

/* ---------- Video và nội dung nhúng ---------- */
/* Khung giữ tỷ lệ 16:9 để video không vỡ khung trên điện thoại */
.video-embed {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    margin: 1.25rem 0;
    border-radius: 10px;
    overflow: hidden;
    background-color: #000;
}

.video-embed iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* ---------- Danh sách công việc ---------- */
.post-content li:has(> input[type="checkbox"]) {
    list-style: none;
    margin-left: -1.2rem;
}

.post-content input[type="checkbox"] {
    margin-right: 0.45rem;
    vertical-align: middle;
}

/* ---------- Chú thích cuối trang ---------- */
.post-content .footnotes {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--bs-border-color);
    font-size: 0.9em;
    color: var(--bs-secondary-color);
}

.post-content .footnotes ol {
    padding-left: 1.2rem;
}

/* Nhảy từ chú thích lên đúng chỗ, không bị thanh điều hướng che */
.post-content [id^="fn-"],
.post-content [id^="fnref-"] {
    scroll-margin-top: 5rem;
}

/* ---------- Khu luyện thi chứng chỉ ---------- */

/* Đề bài và đáp án là HTML lấy từ nguồn ngoài: ép nó nằm gọn trong khung thay vì
   để bảng rộng đẩy ngang cả trang. */
.exam-question,
.exam-explanation {
    overflow-x: auto;
}

.exam-question table,
.exam-explanation table {
    width: 100%;
    margin-bottom: 1rem;
    border-collapse: collapse;
}

.exam-question th,
.exam-question td,
.exam-explanation th,
.exam-explanation td {
    border: 1px solid var(--bs-border-color);
    padding: .35rem .5rem;
    font-size: .9rem;
}

.exam-question img,
.exam-explanation img {
    max-width: 100%;
    height: auto;
}

.exam-question p:last-child,
.exam-explanation p:last-child {
    margin-bottom: 0;
}

/* Đồng hồ đếm ngược bám theo đầu trang khi cuộn danh sách đáp án dài */
#dong-ho {
    font-variant-numeric: tabular-nums;
}

/* ---------- Logo chứng chỉ ---------- */

.cert-logo {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    object-fit: contain;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    padding: 4px;
}

.cert-logo-lon {
    width: 64px;
    height: 64px;
}

/* Huy hiệu chữ đầu, dùng khi chứng chỉ chưa có logo riêng */
.cert-logo-chu {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .8rem;
    letter-spacing: .02em;
    color: #fff;
    background: var(--ncc-mau, #6b7280);
    border: 0;
    padding: 0;
}

.cert-logo-lon.cert-logo-chu { font-size: 1rem; }

/* Màu theo nhà cung cấp để nhìn lướt cũng phân biệt được.
   Đặt qua biến chứ không đặt thẳng `background`: huy hiệu có ở hai kích cỡ (thẻ lớn ở
   /luyen-thi và ảnh nhỏ ở trang chi tiết) nên phải hoạt động với cả hai lớp, và cách này
   không phụ thuộc thứ tự khai trong tệp — cùng độ đặc hiệu thì quy tắc viết sau thắng,
   rất dễ vô tình biến mọi huy hiệu thành màu xám mặc định. */
.ncc-aws        { --ncc-mau: #d97706; }
.ncc-microsoft  { --ncc-mau: #2563eb; }
.ncc-google     { --ncc-mau: #16a34a; }
.ncc-pmi        { --ncc-mau: #7c3aed; }
.ncc-kubernetes { --ncc-mau: #0ea5e9; }
.ncc-khac       { --ncc-mau: #64748b; }

/* ---------- Lưới thẻ chứng chỉ ở /luyen-thi ---------- */

/* Một cột trên điện thoại, hai cột từ md, ba cột từ xl — dùng grid chứ không dùng
   .row của Bootstrap vì thẻ ở đây phải tự cao bằng nhau theo hàng. */
.luoi-chung-chi {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px)  { .luoi-chung-chi { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1200px) { .luoi-chung-chi { grid-template-columns: repeat(3, 1fr); } }

.the-cc {
    position: relative;
    display: block;
    /* Chừa bên phải đúng chỗ cho logo tròn 96px cộng lề, nếu không tiêu đề dài sẽ chui
       xuống dưới ảnh. */
    padding: 1.5rem 7.5rem 1.5rem 1.5rem;
    min-height: 144px;
    border: 1px solid var(--bs-border-color);
    border-radius: .75rem;
    background: var(--bs-body-bg);
    color: inherit;
    text-decoration: none;
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.the-cc:hover,
.the-cc:focus-visible {
    transform: translateY(-2px);
    border-color: var(--bs-primary-border-subtle);
    box-shadow: 0 .5rem 1.25rem rgba(0, 0, 0, .08);
    color: inherit;
}

[data-bs-theme="dark"] .the-cc:hover,
[data-bs-theme="dark"] .the-cc:focus-visible {
    box-shadow: 0 .5rem 1.25rem rgba(0, 0, 0, .45);
}

.the-cc-ten {
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.35;
    margin: 0 0 .75rem;
    /* Tên chứng chỉ dài tới 60 ký tự; cắt ở hai dòng để mọi thẻ cùng chiều cao. */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (min-width: 768px) { .the-cc-ten { font-size: 1.25rem; } }

.the-cc-so-lieu {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem 1rem;
    font-size: .8125rem;
    color: var(--bs-secondary-color);
}

.the-cc-so-lieu > span {
    display: inline-flex;
    align-items: center;
    gap: .375rem;
}

.the-cc-so-lieu .bi {
    color: var(--bs-primary);
    font-size: .95em;
}

/* Logo tròn nằm giữa cạnh phải, nhích to ra khi rê chuột lên thẻ */
.the-cc-logo {
    position: absolute;
    right: 1rem;
    top: 50%;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: contain;
    /* Nền trắng cố định: phần lớn logo nhà cung cấp là PNG nền trong suốt, để nền tối
       xuyên qua thì chữ đen trên logo biến mất. */
    background: #fff;
    border: 1px solid var(--bs-border-color);
    padding: 8px;
    transform: translateY(-50%);
    transition: transform .3s ease;
}

.the-cc:hover .the-cc-logo,
.the-cc:focus-visible .the-cc-logo {
    transform: translateY(-50%) scale(1.05);
}

.the-cc-logo-chu {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: .03em;
    color: #fff;
    background: var(--ncc-mau, #6b7280);
    border: 0;
    padding: 0;
}

/* Vạch mỏng sát đáy thẻ, không chiếm thêm chiều cao */
.the-cc-tien-do {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    height: 3px;
    background: var(--bs-tertiary-bg);
}

.the-cc-tien-do .tien-do-viet { background: var(--bs-success); }
.the-cc-tien-do .tien-do-anh  { background: var(--bs-success-border-subtle); }

/* Thẻ đề thi ở trang chi tiết: nội dung ngắn hơn nên không cần cao bằng thẻ chứng chỉ.
   `overflow: visible` là bắt buộc — .stretched-link phủ ra bằng ::after tuyệt đối, để
   overflow:hidden thì phần phủ bị cắt và chỉ bấm được đúng cái nút. */
.the-cc-nho {
    min-height: 0;
    overflow: visible;
}

.the-cc-nho .the-cc-ten { margin-bottom: .5rem; }

/* Điện thoại hẹp: thu logo lại để tiêu đề còn đủ chỗ thở */
@media (max-width: 400px) {
    .the-cc { padding-right: 6rem; }
    .the-cc-logo { width: 72px; height: 72px; }
    .the-cc-logo-chu { font-size: 1.05rem; }
}
