:root {
    --ht-page-bg: #eef1f7;
    --ht-text: #1f2533;
    --ht-muted: #6c768a;
    --ht-nav-bg: rgba(20, 27, 39, 0.92);
    --ht-surface: #ffffff;
    --ht-surface-2: #f5f7fb;
    --ht-border: #dce1ea;
    --ht-accent: #18a0d8;
    --ht-accent-2: #6f42c1;
}

[data-bs-theme="dark"] {
    --ht-page-bg: #141b27;
    --ht-text: #e8edf5;
    --ht-muted: #98a3b8;
    --ht-nav-bg: rgba(17, 23, 34, 0.94);
    --ht-surface: #242e3f;
    --ht-surface-2: #2c3649;
    --ht-border: rgba(255, 255, 255, 0.08);
    --ht-accent: #17a4dd;
    --ht-accent-2: #7a4ddb;
}

html,
body {
    min-height: 100%;
}

body {
    color: var(--ht-text);
    background:
        radial-gradient(1200px 600px at 12% 8%, rgba(24, 160, 216, 0.22), transparent 60%),
        radial-gradient(900px 500px at 88% 10%, rgba(111, 66, 193, 0.22), transparent 60%),
        var(--ht-page-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1 0 auto;
}

.pt-nav {
    padding-top: 4.35rem;
}

.navbar-glass {
    background: var(--ht-nav-bg);
    backdrop-filter: blur(10px);
    border-color: var(--ht-border) !important;
}

.ht-topbar .navbar-brand,
.ht-topbar .btn,
.ht-topbar .nav-link {
    color: #f2f6ff;
    border-color: rgba(255, 255, 255, 0.28);
}

.ht-topbar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1rem;
    min-height: 56px;
}

.ht-topbar-left {
    justify-self: start;
}

.ht-topbar-center {
    justify-self: center;
    align-items: center;
}

.ht-topbar-right {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ht-top-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    line-height: 1.1;
    width: 2.2rem;
    height: 2.2rem;
    padding: 0;
    justify-content: center;
}

.ht-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    line-height: 1;
}

.ht-topbar .btn:hover,
.ht-topbar .nav-link:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.45);
}

.ht-topbar .btn.btn-outline-light {
    background: rgba(255, 255, 255, 0.02);
    color: #f2f6ff;
    border-color: rgba(255, 255, 255, 0.28);
}

.ht-topbar .btn.btn-outline-light:hover,
.ht-topbar .btn.btn-outline-light:focus,
.ht-topbar .btn.btn-outline-light:active,
.ht-topbar .btn.btn-outline-light.active,
.ht-topbar .btn-check:checked + .btn.btn-outline-light,
.ht-topbar .show > .btn.btn-outline-light.dropdown-toggle {
    background: rgba(255, 255, 255, 0.14) !important;
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.52) !important;
}

.ht-topbar .btn.btn-outline-light:focus-visible {
    box-shadow: 0 0 0 0.2rem rgba(111, 163, 255, 0.32);
}

.ht-desktop-nav {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    padding: 0.4rem 0;
}

.ht-desktop-link {
    color: #d9e4fa;
    text-decoration: none;
    white-space: nowrap;
    font-weight: 500;
    opacity: 0.9;
}

.ht-desktop-link:hover {
    color: #ffffff;
    opacity: 1;
}

.ht-hero-shell {
    padding: 0;
    border-radius: 1.25rem;
    background: linear-gradient(120deg, rgba(24, 160, 216, 0.08), rgba(122, 77, 219, 0.08));
    border: 1px solid var(--ht-border);
    overflow: hidden;
}

.ht-hero-card {
    background: linear-gradient(140deg, rgba(16, 26, 46, 0.72), rgba(34, 44, 66, 0.82));
    border: 1px solid var(--ht-border);
}

.ht-hero-slide {
    min-height: 560px;
    background-size: cover;
    background-position: center;
    border-radius: 0;
    display: flex;
    align-items: end;
    overflow: hidden;
}

.ht-hero-overlay {
    width: 100%;
    padding: 2rem;
    color: #f6f8ff;
    background: linear-gradient(180deg, rgba(5, 10, 19, 0.1) 10%, rgba(8, 14, 26, 0.86) 85%);
}

.ht-chip {
    background: rgba(255, 255, 255, 0.16);
    color: #f8fbff;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.ht-post-card {
    background: var(--ht-surface);
    border: 1px solid var(--ht-border);
    border-radius: 1.3rem;
    overflow: hidden;
    box-shadow: 0 14px 40px rgba(15, 22, 36, 0.14);
}

[data-bs-theme="dark"] .ht-post-card {
    box-shadow: 0 18px 44px rgba(3, 8, 18, 0.45);
}

.ht-card-image {
    height: 230px;
    object-fit: cover;
    background: #1f2937;
}

.ht-title {
    font-weight: 700;
    line-height: 1.25;
}

.ht-excerpt,
.ht-meta {
    color: var(--ht-muted);
}

.ht-read-btn {
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    background: linear-gradient(140deg, var(--ht-accent), var(--ht-accent-2));
    border: 0;
    color: #fff;
}

.ht-read-btn:hover {
    color: #fff;
    filter: brightness(1.06);
}

.ht-article-cover {
    max-height: 520px;
    object-fit: cover;
    width: 100%;
    background: #1f2937;
}

.ht-article-gallery .carousel-indicators [data-bs-target] {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.ht-article-gallery .carousel-control-prev,
.ht-article-gallery .carousel-control-next {
    width: 8%;
}

.ht-article-content {
    font-size: 1.05rem;
    line-height: 1.75;
}

/* Utility: denser lists when <p> is used inside <li> */
.ht-list-tight li > p {
    margin-bottom: 0.35rem;
}

.ht-list-tight li > p:last-child {
    margin-bottom: 0;
}

/* Auto-tight lists inside article content */
.ht-article-content li > p {
    margin-bottom: 0.35rem;
}

.ht-article-content li > p:last-child {
    margin-bottom: 0;
}

.ht-article-meta-row {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    flex-wrap: wrap;
}

.ht-article-meta-row span {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.ht-article-meta-row i {
    font-size: 0.95rem;
    opacity: 0.9;
}

.ht-ai-btn {
    --ht-ai-a: #ff4d6d;
    --ht-ai-b: #7a4ddb;
    --ht-ai-c: #4d9bff;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--ht-ai-c) 58%, #ffffff 42%);
    background:
        linear-gradient(var(--ht-surface), var(--ht-surface)) padding-box,
        linear-gradient(110deg, var(--ht-ai-a), var(--ht-ai-b), var(--ht-ai-c)) border-box;
    color: var(--ht-text);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding-inline: 0.85rem;
}

.ht-ai-btn:hover,
.ht-ai-btn:focus,
.ht-ai-btn:active,
.ht-ai-btn.show {
    color: var(--ht-text) !important;
    border-color: color-mix(in srgb, var(--ht-ai-c) 70%, #ffffff 30%);
    background:
        linear-gradient(color-mix(in srgb, var(--ht-surface) 94%, var(--ht-ai-c) 6%), color-mix(in srgb, var(--ht-surface) 94%, var(--ht-ai-b) 6%)) padding-box,
        linear-gradient(110deg, var(--ht-ai-a), var(--ht-ai-b), var(--ht-ai-c)) border-box;
}

.ht-ai-menu {
    min-width: 220px;
    border-radius: 0.8rem;
    border: 1px solid var(--ht-border);
    box-shadow: 0 14px 34px rgba(16, 24, 38, 0.18);
}

.ht-ai-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

@media (max-width: 768px) {
    .ht-ai-btn {
        width: 100%;
        justify-content: center;
    }

    .dropdown .ht-ai-menu {
        width: 100%;
        min-width: 0;
    }
}

.ht-article-content img,
.ht-article-content table {
    max-width: 100%;
    height: auto;
}

.ht-article-content table,
.ht-article-content .ht-table {
    width: 100% !important;
    margin: 1.25rem auto;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    border: 1px solid var(--ht-border);
    border-radius: 0.9rem;
    background: var(--ht-surface);
    box-shadow: 0 8px 24px rgba(18, 26, 39, 0.08);
}

.ht-article-content table thead th,
.ht-article-content .ht-table thead th {
    background: color-mix(in srgb, var(--ht-accent) 16%, var(--ht-surface));
    color: var(--ht-text);
    font-weight: 700;
}

.ht-article-content table th,
.ht-article-content table td,
.ht-article-content .ht-table th,
.ht-article-content .ht-table td {
    padding: 0.7rem 0.85rem;
    border-right: 1px solid var(--ht-border);
    border-bottom: 1px solid var(--ht-border);
    vertical-align: top;
    text-align: left;
}

.ht-article-content table tr > *:last-child,
.ht-article-content .ht-table tr > *:last-child {
    border-right: 0;
}

.ht-article-content table tbody tr:last-child > *,
.ht-article-content .ht-table tbody tr:last-child > * {
    border-bottom: 0;
}

[data-bs-theme="dark"] .ht-article-content table,
[data-bs-theme="dark"] .ht-article-content .ht-table {
    box-shadow: 0 10px 28px rgba(2, 8, 20, 0.45);
    background: color-mix(in srgb, var(--ht-surface) 88%, #000);
}

[data-bs-theme="dark"] .ht-article-content table thead th,
[data-bs-theme="dark"] .ht-article-content .ht-table thead th {
    background: color-mix(in srgb, var(--ht-accent) 22%, var(--ht-surface));
}

.ht-search-modal {
    background: rgba(6, 10, 18, 0.92);
    color: #eef3ff;
}

.modal-backdrop.show {
    opacity: 0.82;
}

.ht-search-input-wrap .form-control {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

.ht-search-input-wrap .form-control::placeholder {
    color: rgba(235, 242, 255, 0.7);
}

.ht-search-item {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 1rem;
}

.ht-search-image {
    width: 96px;
    height: 72px;
    object-fit: cover;
    border-radius: 0.7rem;
    background: #2a3448;
}

.ht-mobile-canvas {
    width: 100vw !important;
    max-width: 100vw !important;
    background: rgba(8, 13, 24, 0.98);
    color: #e9efff;
}

.ht-mobile-nav .nav-link {
    color: #eef3ff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.85rem 0;
    font-size: 1.05rem;
}

.pagination .page-link {
    background: var(--ht-surface);
    color: var(--ht-text);
    border-color: var(--ht-border);
}

.pagination .page-item.active .page-link {
    background: linear-gradient(140deg, var(--ht-accent), var(--ht-accent-2));
    border-color: transparent;
    color: #fff;
}

footer {
    border-color: var(--ht-border) !important;
    background: color-mix(in srgb, var(--ht-surface-2) 82%, transparent) !important;
}

@media (max-width: 992px) {
    .pt-nav {
        padding-top: 4.15rem;
    }

    .ht-topbar {
        grid-template-columns: auto 1fr auto;
    }

    .ht-topbar-left {
        min-width: 0;
    }

    .ht-topbar .navbar-brand {
        max-width: 180px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .ht-hero-slide {
        min-height: 360px;
    }

    .ht-hero-overlay {
        padding: 1.1rem;
    }

    .ht-card-image {
        height: 210px;
    }

    .ht-article-cover {
        max-height: 320px;
    }
}
