/**
 * History of Vietnam Template — CSS
 * Design inspired by worldhistory.org
 * Bootstrap 5 based
 *
 * Color Palette:
 *   --primary:   #1a2e44  (deep navy)
 *   --accent:    #c0392b  (Vietnamese red)
 *   --gold:      #c9973a  (antique gold)
 *   --bg:        #f7f3ee  (warm parchment)
 *   --card-bg:   #ffffff
 *   --border:    #e0d5c5
 *   --text:      #2c2c2c
 *   --text-muted:#6b6b6b
 */

/* ============================================================
   CSS CUSTOM PROPERTIES
   ============================================================ */
:root {
    --hist-primary:       #1a2e44;
    --hist-primary-light: #24405f;
    --hist-accent:        #c0392b;
    --hist-accent-hover:  #a93226;
    --hist-gold:          #c9973a;
    --hist-gold-light:    #f0c060;
    --hist-bg:            #f7f3ee;
    --hist-bg-alt:        #efe9e0;
    --hist-card-bg:       #ffffff;
    --hist-border:        #e0d5c5;
    --hist-border-dark:   #c8bdb0;
    --hist-text:          #2c2c2c;
    --hist-text-muted:    #6b6b6b;
    --hist-text-light:    #ffffff;
    --hist-topbar-bg:     #0f1e30;
    --hist-footer-bg:     #111d2b;
    --hist-footer-text:   #b0bec5;

    --hist-font-heading:  'Merriweather', 'Georgia', serif;
    --hist-font-body:     'Open Sans', 'Segoe UI', sans-serif;

    --hist-radius:        6px;
    --hist-radius-lg:     12px;
    --hist-shadow:        0 2px 8px rgba(0,0,0,.08);
    --hist-shadow-md:     0 4px 20px rgba(0,0,0,.12);
    --hist-transition:    all 0.25s ease;
}

/* Sepia scheme */
[data-color-scheme="sepia"] {
    --hist-primary:       #5c3a1e;
    --hist-primary-light: #7a4e2d;
    --hist-accent:        #8b4513;
    --hist-accent-hover:  #6d3510;
    --hist-gold:          #b8860b;
    --hist-bg:            #fdf6e3;
    --hist-bg-alt:        #f5ead0;
    --hist-border:        #d4c5a0;
}

/* Dark scheme */
[data-color-scheme="dark"] {
    --hist-primary:       #0d1b2a;
    --hist-primary-light: #162535;
    --hist-accent:        #e74c3c;
    --hist-gold:          #f1c40f;
    --hist-bg:            #1a1a2e;
    --hist-bg-alt:        #16213e;
    --hist-card-bg:       #0f3460;
    --hist-border:        #2c3e50;
    --hist-text:          #ecf0f1;
    --hist-text-muted:    #95a5a6;
    --hist-topbar-bg:     #060d15;
    --hist-footer-bg:     #060d15;
}

/* ============================================================
   GLOBAL RESET & BASE
   ============================================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body.history-template {
    font-family: var(--hist-font-body);
    font-size: 16px;
    line-height: 1.7;
    color: var(--hist-text);
    background-color: var(--hist-bg);
    margin: 0;
    padding: 0;
}

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

a {
    color: var(--hist-accent);
    text-decoration: none;
    transition: color var(--hist-transition);
}

a:hover {
    color: var(--hist-accent-hover);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--hist-font-heading);
    color: var(--hist-primary);
    font-weight: 700;
    line-height: 1.3;
}

/* ============================================================
   TOP BAR
   ============================================================ */
.topbar-strip {
    background-color: var(--hist-topbar-bg);
    color: var(--hist-footer-text);
    font-size: 0.8rem;
    padding: 6px 0;
    border-bottom: 2px solid var(--hist-accent);
}

.topbar-tagline {
    color: var(--hist-gold-light);
    font-style: italic;
    letter-spacing: 0.02em;
}

.topbar-social {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
    color: var(--hist-footer-text);
    font-size: 0.75rem;
    transition: var(--hist-transition);
}

.topbar-social:hover {
    background: var(--hist-accent);
    color: #fff;
}

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
    background-color: var(--hist-primary);
    border-bottom: 3px solid var(--hist-gold);
    z-index: 1000;
    box-shadow: var(--hist-shadow-md);
}

.header-inner {
    padding: 14px 0;
    gap: 16px;
}

/* Brand */
.brand-link {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
}

.site-logo {
    height: 52px;
    width: auto;
}

.site-logo-text {
    font-family: var(--hist-font-heading);
    font-size: 1.75rem;
    font-weight: 900;
    color: #fff;
    letter-spacing: -0.01em;
    line-height: 1;
    display: inline-block;
}

.site-logo-text::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 1.6em;
    background: var(--hist-gold);
    margin-right: 10px;
    vertical-align: middle;
    border-radius: 2px;
}

.site-tagline {
    font-size: 0.75rem;
    color: rgba(255,255,255,.55);
    font-style: italic;
    margin-top: 2px;
    letter-spacing: 0.03em;
}

/* Header Search */
.header-search-form {
    min-width: 280px;
}

.search-input-group {
    display: flex;
    border-radius: 30px;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,.2);
    transition: border-color var(--hist-transition);
}

.search-input-group:focus-within {
    border-color: var(--hist-gold);
}

.search-input {
    flex: 1;
    background: rgba(255,255,255,.1);
    border: none;
    outline: none;
    padding: 8px 16px;
    color: #fff;
    font-size: 0.875rem;
    font-family: var(--hist-font-body);
}

.search-input::placeholder {
    color: rgba(255,255,255,.45);
}

.search-btn {
    background: var(--hist-accent);
    border: none;
    color: #fff;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background var(--hist-transition);
}

.search-btn:hover {
    background: var(--hist-accent-hover);
}

/* Mobile Toggle */
.navbar-toggler {
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.2);
    border-radius: var(--hist-radius);
    padding: 6px 12px;
    color: #fff;
    cursor: pointer;
}

.navbar-toggler-icon-custom {
    font-size: 1.1rem;
}

/* ============================================================
   NAVIGATION — shared wrapper
   ============================================================ */
.main-nav {
    background-color: var(--hist-primary-light);
    border-top: 1px solid rgba(255,255,255,.08);
}

/* ============================================================
   MOD_MENU — DROPDOWN LAYOUT  (templates/history/html/mod_menu/dropdown.php)
   Prefix: hist-  to avoid collisions with Bootstrap utilities.
   ============================================================ */

/* ── Top-level list ─────────────────────────────────────────── */
.hist-nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
    align-items: stretch;
}

/* ── Top-level item ─────────────────────────────────────────── */
.hist-nav-item {
    position: relative;
}

/* ── Top-level link ─────────────────────────────────────────── */
.hist-nav-link {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 14px;
    color: rgba(255,255,255,.85);
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition: var(--hist-transition);
    border-bottom: 3px solid transparent;
    line-height: 1.4;
    /* ensure heading spans behave the same */
    background: none;
    border-left: none;
    border-right: none;
    border-top: none;
}

.hist-nav-link:hover,
.hist-nav-item.active > .hist-nav-link,
.hist-nav-item.current > .hist-nav-link {
    color: #fff;
    background-color: rgba(255,255,255,.1);
    border-bottom-color: var(--hist-gold);
}

.hist-nav-item.active > .hist-nav-link,
.hist-nav-item.current > .hist-nav-link {
    border-bottom-color: var(--hist-gold);
}

/* Caret icons */
.hist-caret {
    display: inline-flex;
    font-size: 0.65rem;
    opacity: .7;
    transition: transform var(--hist-transition);
}

.hist-caret-right {
    margin-left: auto;
    padding-left: 8px;
}

/* ── Dropdown container (level 2) ───────────────────────────── */
.hist-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 230px;
    background: var(--hist-primary);
    border-top: 3px solid var(--hist-accent);
    border-radius: 0 0 var(--hist-radius) var(--hist-radius);
    box-shadow: var(--hist-shadow-md);
    list-style: none;
    padding: 6px 0;
    margin: 0;
    z-index: 1050;
    /* Prevent gap between nav link and dropdown */
    margin-top: -1px;
}

/* Open on hover — desktop */
@media (min-width: 992px) {
    .hist-has-dropdown:hover > .hist-dropdown,
    .hist-has-dropdown:focus-within > .hist-dropdown {
        display: block;
    }

    /* Rotate caret when open */
    .hist-has-dropdown:hover > .hist-nav-link .hist-caret,
    .hist-has-dropdown:focus-within > .hist-nav-link .hist-caret {
        transform: rotate(180deg);
    }
}

/* Open via JS toggle (.open class) — mobile & keyboard */
.hist-has-dropdown.open > .hist-dropdown {
    display: block;
}

/* ── Dropdown items (level 2) ───────────────────────────────── */
.hist-nav-sub-item {
    position: relative;
}

.hist-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 18px;
    color: rgba(255,255,255,.82);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    background: none;
    border: none;
    transition: var(--hist-transition);
}

.hist-dropdown-item:hover,
.hist-nav-sub-item.active > .hist-dropdown-item,
.hist-nav-sub-item.current > .hist-dropdown-item {
    color: var(--hist-gold-light);
    background: rgba(255,255,255,.07);
    padding-left: 24px;
}

.hist-nav-sub-item.active > .hist-dropdown-item,
.hist-nav-sub-item.current > .hist-dropdown-item {
    color: var(--hist-gold-light);
    border-left: 3px solid var(--hist-gold);
    padding-left: 21px;
}

/* ── Submenu container (level 3+) ──────────────────────────── */
.hist-submenu {
    display: none;
    position: absolute;
    top: 0;
    left: 100%;
    min-width: 210px;
    background: var(--hist-primary-light);
    border-top: 3px solid var(--hist-gold);
    border-radius: 0 var(--hist-radius) var(--hist-radius) 0;
    box-shadow: var(--hist-shadow-md);
    list-style: none;
    padding: 6px 0;
    margin: 0;
    z-index: 1060;
}

@media (min-width: 992px) {
    .hist-has-submenu:hover > .hist-submenu,
    .hist-has-submenu:focus-within > .hist-submenu {
        display: block;
    }

    .hist-has-submenu:hover > .hist-dropdown-item .hist-caret-right {
        transform: rotate(90deg);
    }
}

.hist-has-submenu.open > .hist-submenu {
    display: block;
}

/* ── Dropdown divider ───────────────────────────────────────── */
.hist-dropdown-divider {
    border: none;
    border-top: 1px solid rgba(255,255,255,.1);
    margin: 4px 12px;
}

/* ── Dropdown label (named group) ──────────────────────────── */
.hist-dropdown-label {
    display: block;
    padding: 7px 18px 4px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--hist-gold);
    cursor: default;
}

/* ── Dropdown header (heading type inside dropdown) ─────────── */
.hist-dropdown-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255,255,255,.45);
    cursor: default;
    white-space: nowrap;
}

/* ── Top-level separator (vertical rule) ─────────────────────── */
.hist-nav-divider {
    display: flex;
    align-items: center;
    padding: 0 6px;
    color: rgba(255,255,255,.2);
    font-size: 0.7rem;
    cursor: default;
    user-select: none;
}

.hist-nav-divider::before {
    content: '';
    display: block;
    width: 1px;
    height: 16px;
    background: rgba(255,255,255,.18);
}

.hist-nav-divider-label {
    padding: 0 6px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,.35);
}

/* ── Icon inside menu link ──────────────────────────────────── */
.hist-menu-icon {
    font-size: 0.85em;
    flex-shrink: 0;
}

.hist-menu-label {
    /* allow text to wrap on very small screens */
    white-space: normal;
}

/* ── Mobile: collapsed nav ──────────────────────────────────── */
@media (max-width: 991.98px) {
    .hist-nav-menu {
        flex-direction: column;
        padding: 8px 0;
    }

    .hist-nav-link {
        border-bottom: 1px solid rgba(255,255,255,.06);
        border-bottom-width: 1px !important; /* override the 3px active state */
    }

    .hist-nav-item.active > .hist-nav-link,
    .hist-nav-item.current > .hist-nav-link {
        border-left: 3px solid var(--hist-gold);
        padding-left: 11px;
        border-bottom-color: rgba(255,255,255,.06);
    }

    /* Dropdowns are full-width and block on mobile */
    .hist-dropdown,
    .hist-submenu {
        position: static;
        width: 100%;
        box-shadow: none;
        border-top: none;
        border-radius: 0;
        border-left: 3px solid var(--hist-gold);
        margin-left: 14px;
        background: rgba(0,0,0,.18);
        display: none;
        padding: 2px 0;
    }

    .hist-has-dropdown.open > .hist-dropdown,
    .hist-has-submenu.open > .hist-submenu {
        display: block;
    }

    .hist-dropdown-item {
        padding-left: 14px;
        white-space: normal;
    }

    .hist-submenu {
        border-left-color: rgba(255,255,255,.2);
        margin-left: 28px;
    }

    .hist-caret-right {
        /* point down on mobile */
    }
}

/* ── Legacy fallback: plain nav-menu-list (no mod_menu module) ─ */
.nav-menu-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0;
    flex-wrap: wrap;
}

.nav-item {
    position: relative;
}

.nav-item .nav-link {
    display: block;
    padding: 10px 14px;
    color: rgba(255,255,255,.85);
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
    transition: var(--hist-transition);
}

.nav-item .nav-link:hover,
.nav-item .nav-link.active {
    color: #fff;
    background-color: rgba(255,255,255,.1);
}

.nav-item .nav-link.active {
    border-bottom: 3px solid var(--hist-gold);
}

.nav-item.dropdown:hover .dropdown-nav,
.nav-item.dropdown:focus-within .dropdown-nav {
    display: block;
}

.dropdown-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--hist-primary);
    min-width: 220px;
    box-shadow: var(--hist-shadow-md);
    list-style: none;
    padding: 8px 0;
    margin: 0;
    border-top: 3px solid var(--hist-accent);
    border-radius: 0 0 var(--hist-radius) var(--hist-radius);
    z-index: 999;
}

.dropdown-nav li a {
    display: block;
    padding: 8px 16px;
    color: rgba(255,255,255,.8);
    font-size: 0.85rem;
    transition: var(--hist-transition);
}

.dropdown-nav li a:hover {
    background: rgba(255,255,255,.08);
    color: var(--hist-gold-light);
    padding-left: 22px;
}

/* ============================================================
   HERO SECTION
   ============================================================ */
.hero-section {
    background: linear-gradient(135deg, var(--hist-primary) 0%, var(--hist-primary-light) 100%);
    color: #fff;
    min-height: 320px;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* ============================================================
   BREADCRUMBS
   ============================================================ */
.breadcrumbs-bar {
    background: var(--hist-bg-alt);
    border-bottom: 1px solid var(--hist-border);
    padding: 8px 0;
    font-size: 0.82rem;
}

.breadcrumbs-bar .breadcrumb {
    margin: 0;
    background: none;
    padding: 0;
}

.breadcrumbs-bar .breadcrumb-item + .breadcrumb-item::before {
    content: '›';
    color: var(--hist-text-muted);
}

.breadcrumbs-bar .breadcrumb-item a {
    color: var(--hist-accent);
}

/* ============================================================
   FEATURED SECTION
   ============================================================ */
.featured-section {
    background: var(--hist-bg-alt);
    padding: 30px 0 20px;
    border-bottom: 1px solid var(--hist-border);
}

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
.site-main {
    padding: 36px 0 48px;
}

.main-content {
    min-height: 400px;
}

/* Article content styles */
.main-content h1 {
    font-size: 2rem;
    margin-bottom: 0.5em;
    color: var(--hist-primary);
    border-bottom: 3px solid var(--hist-accent);
    padding-bottom: 0.4em;
}

.main-content h2 {
    font-size: 1.5rem;
    margin-top: 1.8em;
    margin-bottom: 0.5em;
    color: var(--hist-primary);
}

.main-content h2::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 1em;
    background: var(--hist-gold);
    margin-right: 8px;
    vertical-align: middle;
    border-radius: 2px;
}

.main-content h3 {
    font-size: 1.2rem;
    margin-top: 1.4em;
    color: var(--hist-primary);
}

.main-content p {
    margin-bottom: 1.2em;
    text-align: justify;
}

.main-content blockquote {
    border-left: 4px solid var(--hist-gold);
    background: var(--hist-bg-alt);
    padding: 16px 20px;
    margin: 24px 0;
    border-radius: 0 var(--hist-radius) var(--hist-radius) 0;
    font-style: italic;
    color: var(--hist-primary);
}

.main-content img {
    border-radius: var(--hist-radius);
    box-shadow: var(--hist-shadow);
    margin: 1em 0;
}

.main-content figure {
    margin: 1.5em 0;
    text-align: center;
}

.main-content figcaption {
    font-size: 0.82rem;
    color: var(--hist-text-muted);
    font-style: italic;
    margin-top: 6px;
}

/* ============================================================
   CONTENT CARDS (Article listing)
   ============================================================ */
.history-card {
    background: var(--hist-card-bg);
    border: 1px solid var(--hist-border);
    border-radius: var(--hist-radius-lg);
    overflow: hidden;
    box-shadow: var(--hist-shadow);
    transition: var(--hist-transition);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.history-card:hover {
    box-shadow: var(--hist-shadow-md);
    transform: translateY(-3px);
    border-color: var(--hist-gold);
}

.history-card-img-wrap {
    position: relative;
    aspect-ratio: 16/10;
    overflow: hidden;
}

.history-card-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
    margin: 0;
    box-shadow: none;
    border-radius: 0;
}

.history-card:hover .history-card-img-wrap img {
    transform: scale(1.05);
}

.history-card-category {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--hist-accent);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 3px 10px;
    border-radius: 20px;
}

.history-card-body {
    padding: 18px 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.history-card-period {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--hist-text-muted);
    margin-bottom: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.history-card-period i {
    color: var(--hist-gold);
}

.history-card-title {
    font-family: var(--hist-font-heading);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--hist-primary);
    margin-bottom: 10px;
    line-height: 1.4;
}

.history-card-title a {
    color: inherit;
    text-decoration: none;
}

.history-card-title a:hover {
    color: var(--hist-accent);
}

.history-card-excerpt {
    font-size: 0.875rem;
    color: var(--hist-text-muted);
    line-height: 1.6;
    flex: 1;
}

.history-card-footer {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--hist-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--hist-text-muted);
}

.history-card-read-more {
    color: var(--hist-accent);
    font-weight: 600;
    font-size: 0.82rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: var(--hist-transition);
}

.history-card-read-more:hover {
    gap: 8px;
    color: var(--hist-accent-hover);
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar-sticky {
    position: sticky;
    top: 80px;
}

/* Sidebar Widget */
.sidebar-widget {
    background: var(--hist-card-bg);
    border: 1px solid var(--hist-border);
    border-radius: var(--hist-radius-lg);
    overflow: hidden;
    margin-bottom: 28px;
    box-shadow: var(--hist-shadow);
}

.sidebar-widget-header {
    background: var(--hist-primary);
    color: #fff;
    padding: 12px 18px;
    font-family: var(--hist-font-heading);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
    border-left: 4px solid var(--hist-gold);
}

.sidebar-widget-header i {
    color: var(--hist-gold);
}

.sidebar-widget-body {
    padding: 16px 18px;
}

/* Sidebar article list */
.sidebar-article-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-article-item {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--hist-border);
}

.sidebar-article-item:last-child {
    border-bottom: none;
}

.sidebar-article-thumb {
    flex-shrink: 0;
    width: 70px;
    height: 52px;
    border-radius: var(--hist-radius);
    overflow: hidden;
}

.sidebar-article-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    margin: 0;
    box-shadow: none;
    border-radius: 0;
}

.sidebar-article-title {
    font-family: var(--hist-font-heading);
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--hist-primary);
}

.sidebar-article-title a {
    color: inherit;
}

.sidebar-article-title a:hover {
    color: var(--hist-accent);
}

.sidebar-article-date {
    font-size: 0.72rem;
    color: var(--hist-text-muted);
    margin-top: 4px;
}

/* Tags widget */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag-item {
    display: inline-flex;
    align-items: center;
    background: var(--hist-bg-alt);
    color: var(--hist-primary);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid var(--hist-border-dark);
    transition: var(--hist-transition);
    text-decoration: none;
}

.tag-item:hover {
    background: var(--hist-accent);
    color: #fff;
    border-color: var(--hist-accent);
}

/* Timeline widget */
.history-timeline {
    list-style: none;
    padding: 0;
    margin: 0;
    position: relative;
}

.history-timeline::before {
    content: '';
    position: absolute;
    left: 14px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--hist-border);
}

.timeline-item {
    padding-left: 36px;
    padding-bottom: 16px;
    position: relative;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 5px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--hist-gold);
    border: 2px solid var(--hist-card-bg);
    box-shadow: 0 0 0 2px var(--hist-border);
}

.timeline-year {
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--hist-accent);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 2px;
}

.timeline-title {
    font-size: 0.85rem;
    color: var(--hist-primary);
    font-weight: 600;
    line-height: 1.4;
}

.timeline-title a {
    color: inherit;
    text-decoration: none;
}

.timeline-title a:hover {
    color: var(--hist-accent);
}

/* ============================================================
   BOTTOM MODULES SECTION
   ============================================================ */
.bottom-modules-section {
    background: var(--hist-bg-alt);
    padding: 48px 0;
    border-top: 1px solid var(--hist-border);
}

/* ============================================================
   SECTION HEADINGS (module titles)
   ============================================================ */
.section-title {
    font-family: var(--hist-font-heading);
    font-size: 1.4rem;
    color: var(--hist-primary);
    font-weight: 900;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 3px solid var(--hist-border);
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 60px;
    height: 3px;
    background: var(--hist-accent);
}

.section-title-icon {
    color: var(--hist-gold);
    font-size: 1.1rem;
}

/* ============================================================
   MODULE CHROME / CARD STYLE
   ============================================================ */
.moduletable {
    margin-bottom: 32px;
}

.moduletable h3,
.moduletable .module-title {
    font-family: var(--hist-font-heading);
    font-size: 1.1rem;
    color: var(--hist-primary);
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--hist-border);
    position: relative;
}

.moduletable h3::after,
.moduletable .module-title::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 40px;
    height: 2px;
    background: var(--hist-accent);
}

/* Joomla default article list */
.blog .items-row,
.cat-list-row0,
.cat-list-row1 {
    border-bottom: 1px solid var(--hist-border);
    padding-bottom: 24px;
    margin-bottom: 24px;
}

.page-header h1,
.page-header h2 {
    font-family: var(--hist-font-heading);
    color: var(--hist-primary);
    border-bottom: 3px solid var(--hist-accent);
    padding-bottom: 0.4em;
    margin-bottom: 1em;
}

.article-info,
.article-info-term {
    font-size: 0.8rem;
    color: var(--hist-text-muted);
}

.readmore a {
    display: inline-block;
    background: var(--hist-accent);
    color: #fff;
    padding: 7px 18px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background var(--hist-transition);
    text-decoration: none;
}

.readmore a:hover {
    background: var(--hist-accent-hover);
    color: #fff;
}

/* Pagination */
.pagination .page-link {
    color: var(--hist-accent);
    border-color: var(--hist-border);
    background: var(--hist-card-bg);
}

.pagination .page-item.active .page-link {
    background: var(--hist-accent);
    border-color: var(--hist-accent);
    color: #fff;
}

.pagination .page-link:hover {
    background: var(--hist-bg-alt);
    color: var(--hist-accent-hover);
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
    background: var(--hist-footer-bg);
    color: var(--hist-footer-text);
    margin-top: auto;
}

.footer-main {
    padding: 56px 0 32px;
}

.footer-logo-link {
    text-decoration: none;
}

.footer-logo-link .site-logo-text {
    font-size: 1.5rem;
    color: #fff;
}

.footer-about {
    font-size: 0.875rem;
    line-height: 1.7;
    color: var(--hist-footer-text);
    max-width: 320px;
}

.footer-social {
    display: flex;
    gap: 10px;
}

.footer-social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
    color: var(--hist-footer-text);
    font-size: 0.875rem;
    transition: var(--hist-transition);
    text-decoration: none;
}

.footer-social-link:hover {
    background: var(--hist-accent);
    color: #fff;
    transform: translateY(-2px);
}

.footer-heading {
    font-family: var(--hist-font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(255,255,255,.1);
    position: relative;
}

.footer-heading::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 30px;
    height: 2px;
    background: var(--hist-gold);
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 8px;
}

.footer-links a {
    color: var(--hist-footer-text);
    font-size: 0.875rem;
    text-decoration: none;
    transition: var(--hist-transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.footer-links a::before {
    content: '›';
    color: var(--hist-gold);
    font-weight: bold;
}

.footer-links a:hover {
    color: #fff;
    padding-left: 4px;
}

.footer-newsletter-desc {
    font-size: 0.85rem;
    color: var(--hist-footer-text);
    margin-bottom: 12px;
}

.footer-email-input {
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.15);
    color: #fff;
    font-size: 0.875rem;
}

.footer-email-input::placeholder {
    color: rgba(255,255,255,.4);
}

.footer-email-input:focus {
    background: rgba(255,255,255,.15);
    border-color: var(--hist-gold);
    box-shadow: none;
    color: #fff;
}

.footer-newsletter-btn {
    background: var(--hist-accent);
    color: #fff;
    border: none;
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0 18px;
    transition: background var(--hist-transition);
}

.footer-newsletter-btn:hover {
    background: var(--hist-accent-hover);
    color: #fff;
}

/* Footer bottom */
.footer-bottom {
    background: rgba(0,0,0,.25);
    border-top: 1px solid rgba(255,255,255,.06);
    padding: 16px 0;
}

.footer-copyright {
    font-size: 0.82rem;
    color: rgba(255,255,255,.4);
}

.footer-bottom-links {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 0;
}

.footer-bottom-links li::before {
    content: '·';
    color: rgba(255,255,255,.3);
    margin: 0 8px;
}

.footer-bottom-links li:first-child::before {
    display: none;
}

.footer-bottom-links a {
    color: rgba(255,255,255,.45);
    font-size: 0.82rem;
    text-decoration: none;
    transition: color var(--hist-transition);
}

.footer-bottom-links a:hover {
    color: rgba(255,255,255,.85);
}

/* ============================================================
   BACK TO TOP
   ============================================================ */
.back-to-top {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 44px;
    height: 44px;
    background: var(--hist-accent);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    box-shadow: 0 4px 14px rgba(192,57,43,.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: var(--hist-transition);
    z-index: 9999;
    text-decoration: none;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--hist-accent-hover);
    color: #fff;
    transform: translateY(-2px);
}

/* ============================================================
   SYSTEM MESSAGES
   ============================================================ */
#system-message-container {
    margin: 16px 0;
}

#system-message-container .alert {
    border-radius: var(--hist-radius);
    font-size: 0.9rem;
}

/* ============================================================
   SEARCH RESULTS PAGE
   ============================================================ */
.search .result-title a {
    color: var(--hist-primary);
    font-family: var(--hist-font-heading);
    font-weight: 700;
}

.search .result-title a:hover {
    color: var(--hist-accent);
}

.search .result-category {
    font-size: 0.78rem;
    color: var(--hist-text-muted);
}

/* ============================================================
   CONTACT & USER FORMS
   ============================================================ */
.contact-form .form-control,
#member-registration .form-control,
#user-login .form-control {
    border-color: var(--hist-border);
    border-radius: var(--hist-radius);
    font-size: 0.9rem;
}

.contact-form .form-control:focus,
#member-registration .form-control:focus,
#user-login .form-control:focus {
    border-color: var(--hist-gold);
    box-shadow: 0 0 0 3px rgba(201,151,58,.15);
}

.contact-form .btn-primary,
#member-registration .btn-primary,
#user-login .btn-primary {
    background: var(--hist-accent);
    border-color: var(--hist-accent);
    font-weight: 600;
}

.contact-form .btn-primary:hover,
#member-registration .btn-primary:hover,
#user-login .btn-primary:hover {
    background: var(--hist-accent-hover);
    border-color: var(--hist-accent-hover);
}

/* ============================================================
   COMPONENT SPECIFIC — ARTICLE VIEW
   ============================================================ */
.com-content-article__body,
.article-body {
    font-size: 1rem;
    line-height: 1.85;
    color: var(--hist-text);
}

.com-content-article__header h1 {
    font-family: var(--hist-font-heading);
    font-size: 2.1rem;
    font-weight: 900;
    color: var(--hist-primary);
    line-height: 1.25;
    margin-bottom: 0.4em;
}

.article-info-block {
    background: var(--hist-bg-alt);
    border: 1px solid var(--hist-border);
    border-radius: var(--hist-radius);
    padding: 10px 16px;
    margin-bottom: 24px;
    font-size: 0.83rem;
    color: var(--hist-text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.article-info-block i {
    color: var(--hist-gold);
    margin-right: 4px;
}

/* Period badge on articles */
.period-badge {
    display: inline-block;
    background: var(--hist-primary);
    color: var(--hist-gold-light);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 3px 10px;
    border-radius: 3px;
    margin-bottom: 8px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 991.98px) {
    .site-logo-text {
        font-size: 1.4rem;
    }

    .header-inner {
        flex-wrap: wrap;
        padding: 12px 0;
    }

    .main-nav .collapse:not(.show) {
        display: none;
    }

    .nav-menu-list {
        flex-direction: column;
        padding: 8px 0;
    }

    .nav-item .nav-link {
        border-bottom: 1px solid rgba(255,255,255,.06);
    }

    .dropdown-nav {
        position: static;
        box-shadow: none;
        border-top: none;
        border-left: 3px solid var(--hist-gold);
        margin-left: 16px;
        background: rgba(0,0,0,.2);
    }

    .sidebar-sticky {
        position: static;
    }
}

@media (max-width: 767.98px) {
    .topbar-strip .topbar-left {
        display: none;
    }

    body.history-template {
        font-size: 15px;
    }

    .site-main {
        padding: 24px 0 36px;
    }

    .main-content h1 {
        font-size: 1.6rem;
    }

    .footer-main {
        padding: 36px 0 24px;
    }

    .back-to-top {
        bottom: 16px;
        right: 16px;
        width: 38px;
        height: 38px;
        font-size: 0.8rem;
    }
}

@media (max-width: 575.98px) {
    .site-logo-text {
        font-size: 1.2rem;
    }

    .footer-bottom .d-flex {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ============================================================
   UTILITY HELPERS
   ============================================================ */
.text-gold      { color: var(--hist-gold) !important; }
.text-accent    { color: var(--hist-accent) !important; }
.text-primary-hist { color: var(--hist-primary) !important; }
.bg-hist-primary { background-color: var(--hist-primary) !important; }
.bg-hist-accent  { background-color: var(--hist-accent) !important; }
.bg-hist-parchment { background-color: var(--hist-bg) !important; }
.border-gold    { border-color: var(--hist-gold) !important; }
.font-heading   { font-family: var(--hist-font-heading) !important; }

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
    .site-header,
    .topbar-strip,
    .main-nav,
    .sidebar-col,
    .site-footer,
    .bottom-modules-section,
    .back-to-top {
        display: none !important;
    }

    body.history-template {
        background: #fff;
        color: #000;
        font-size: 12pt;
    }

    .main-content h1,
    .main-content h2,
    .main-content h3 {
        color: #000;
    }

    .container-xl {
        max-width: 100% !important;
        padding: 0 !important;
    }
}

/*MODULE HISTORICAL TIMELINE*/
.historical-timeline.horizontal .issues li > .inner { padding: 0 !important; }

.historical-timeline .item-title > a::before {
    content: "\21D2";
}


/*PAGINATION*/
nav.pagination__wrapper {
    overflow: auto;
}

/*BANNER*/
.article-info-term {display: none;}
.featured-section {
    position: relative;
}

.featured-section::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.2; /* Set your background image opacity here */
    background-image: url("../images/dong-lich-su.jpg");
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center -150px;
}


@media (max-width: 767.98px) {
    .featured-section::before {
        background-position: center top;
    }
}

.site-header, .main-nav {position: relative;}
.site-header::before {
    content: "";
    position: absolute;
    z-index: -1;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.2; /* Set your background image opacity here */
    background-image: url("../images/header-bg.jpg");
    background-size: auto;
    background-repeat: repeat-x;
    animation: slide 200s linear infinite;
}

@keyframes slide {
    from { background-position: 0 -80px; }
    to { background-position: -2000px -80px; } /* Matches image width for a seamless loop */
}

/* link icon */
.site-header .nav-link > span {
    padding: 0 !important;
}

/*OFFCANVAS MENU*/
#offcanvasMenu {
    background-color: var(--hist-primary-light);
}

/*CATEGORY BLOG LAYOUT - COPY FROM CASSIOPEIA TEMPLATE*/
@supports (display: grid) {
    .blog-items {
        grid-gap: 1em;
        grid-template-columns: 1fr;
        grid-auto-flow: row;
        margin: 0 0 1em;
        display: grid;
    }

    .blog-items .blog-item {
        padding: 0;
    }

    .blog-items[class^="columns-"] > div, .blog-items[class*=" columns-"] > div {
        flex: 0 auto;
        width: auto;
        max-width: none;
    }

    @media (width >= 992px) {
        .blog-items.columns-2 {
            grid-template-columns: 1fr 1fr;
        }

        .blog-items.columns-3 {
            grid-template-columns: 1fr 1fr 1fr;
        }

        .blog-items.columns-4 {
            grid-template-columns: 1fr 1fr 1fr 1fr;
        }
    }
}

.blog-items[class^="masonry-"], .blog-items[class*=" masonry-"] {
    column-gap: 1em;
    display: block;
}

.blog-items[class^="masonry-"] .blog-item, .blog-items[class*=" masonry-"] .blog-item {
    page-break-inside: avoid;
    break-inside: avoid;
    margin-bottom: 1em;
    display: inline-flex;
}

@media (width >= 992px) {
    .blog-items.masonry-2 {
        column-count: 2;
    }

    .blog-items.masonry-3 {
        column-count: 3;
    }

    .blog-items.masonry-4 {
        column-count: 4;
    }
}

/*CONTENT*/
sup.annotation.badge {
    background: var(--hist-bg-alt);
    color: var(--hist-primary);
}


/*TABLE OF CONTENTS*/
div#toc {
    background: var(--hist-bg-alt);
    border: 1px solid var(--hist-border);
    margin: 10px 0;
    padding: 7px;
    max-height: 120px;
    overflow: hidden;
    position: relative;
    z-index: 1;
}
div#toc .toc-title {
    text-align: left;
}
div#toc::before {
    position: absolute;
    left: 0;
    bottom: 0;
    content: " ";
    width: 100%;
    height: 60px;
    background: -webkit-gradient(linear,left bottom,left top,from(var(--hist-bg-alt)),to(rgba(255,255,255,0)),color-stop(.1,var(--hist-bg-alt)));
}
div#toc.fixed {
    position: fixed;
    top: 0px;
    margin: 0;
    width: auto;
    max-width: 585px;
    max-height: 20px;
    border-color: #BD2031;
}
div#toc.fixed::before {
    height: 0px;
}

div#toc.expand {
    max-height: none;
}

div#toc.expand::before {
    display: none;
}


div#toc li { background: none; }
div#toc li.level-1 { padding-left: 10px; }
div#toc li.level-2 { padding-left: 30px; }
div#toc li.level-3 { padding-left: 50px; }
div#toc li.level-4 { padding-left: 70px; }
div#toc li.level-5 { padding-left: 90px; }
div#toc li.level-6 { padding-left: 110px; }

@media (max-width: 767px) {
    div#toc.fixed {
        max-width: 100%;
    }
}

/*SHARE BUTTONS*/
.sharethis-inline-share-buttons img {
    margin: 0;
}