:root {
    --header-height: 80px;
    --header-accent: #e6002d;
    --header-text: #1c1c1c;
    --header-muted: #555;
    --header-line: #e5e5e5;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-height);
    background: #fff;
    border-bottom: 1px solid var(--header-line);
    color: var(--header-text);
    transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

.site-header.is-scrolled {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 24px;
    height: 100%;
    padding: 0 40px;
}

.header-logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    text-decoration: none;
}

.header-logo img {
    display: block;
    height: 80px;
    width: auto;
}

.header-collapse {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex: 1;
    align-self: stretch;
}

.header-nav {
    flex: 1;
    display: flex;
    justify-content: center;
    align-self: stretch;
}

.header-menu {
    display: flex;
    height: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
}

.header-menu-item {
    height: 100%;
}

.header-chevron {
    display: none;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.header-menu-link {
    position: relative;
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 36px;
    font-size: 18px;
    font-weight: 600;
    color: inherit;
    text-decoration: none;
}

.header-menu-link::after {
    content: "";
    position: absolute;
    left: 20px;
    right: 20px;
    bottom: 0;
    height: 2px;
    background: var(--header-accent);
    transform: scaleX(0);
    transition: transform 0.2s ease;
}

.header-menu-item:hover .header-menu-link,
.header-menu-item:focus-within .header-menu-link {
    color: var(--header-accent);
}

.header-menu-item:hover .header-menu-link::after,
.header-menu-item:focus-within .header-menu-link::after {
    transform: scaleX(1);
}

.header-mega {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    color: var(--header-text);
    border-bottom: 2px solid #26282b;
    box-shadow: 0 24px 40px rgba(0, 0, 0, 0.08);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.header-menu-item:hover .header-mega,
.header-menu-item:focus-within .header-mega {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.header-mega-inner {
    display: flex;
    width: min(1400px, 100%);
    margin: 0 auto;
    padding: 48px 40px 72px;
}

.header-mega-title {
    flex: 0 0 280px;
    margin: 0;
    padding-right: 24px;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.header-mega-columns {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
}

.header-mega-column {
    margin: 0;
    padding: 4px 32px;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 32px;
    border-left: 1px solid var(--header-line);
}

.header-mega-column a {
    font-size: 1.05rem;
    color: inherit;
    text-decoration: none;
    transition: color 0.15s ease;
}

.header-mega-column a:hover {
    color: var(--header-accent);
}

.header-logo {
    order: 1;
}

.header-collapse {
    order: 2;
}

.header-langs {
    order: 3;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
    margin-left: auto;
}

.header-toggle {
    order: 4;
}

.header-lang {
    border: 0;
    padding: 0;
    background: none;
    font: inherit;
    font-size: 0.95rem;
    color: inherit;
    cursor: pointer;
    transition: color 0.15s ease;
}

.header-lang:hover,
.header-lang.is-active {
    color: var(--header-accent);
}

.header-lang-dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.5;
}

.header-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: 8px;
    border: 0;
    background: none;
    cursor: pointer;
    color: inherit;
}

.header-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: currentColor;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.site-header.is-open .header-toggle span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.site-header.is-open .header-toggle span:nth-child(2) {
    opacity: 0;
}

.site-header.is-open .header-toggle span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Bản trong suốt đè lên hero: thêm `header_transparent = 1` vào config của page */
.site-header--transparent {
    position: fixed;
    left: 0;
    right: 0;
}

/* Chỉ chuyển nền trắng khi hover/focus đúng vào các mục menu, không phải toàn header */
.site-header--transparent:not(.is-scrolled):not(.is-open):not(:has(.header-menu:hover)):not(:has(.header-menu:focus-within)) {
    /* no-repeat để hàng pixel trên cùng của gradient không lặp lại xuống vùng border */
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0)) no-repeat;
    border-bottom: 0;
    color: #fff;
}

@media (max-width: 991px) {
    .header-inner {
        padding: 0 20px;
    }

    .header-toggle {
        display: flex;
    }

    .header-collapse {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        max-height: calc(100vh - var(--header-height));
        overflow-y: auto;
        padding: 8px 20px 24px;
        background: #fff;
        color: var(--header-text);
        border-bottom: 1px solid var(--header-line);
        box-shadow: 0 24px 40px rgba(0, 0, 0, 0.08);
    }

    .site-header.is-open .header-collapse {
        display: block;
    }

    .header-nav {
        display: block;
    }

    .header-menu {
        display: block;
        height: auto;
    }

    .header-menu-item {
        height: auto;
        border-bottom: 1px solid var(--header-line);
    }

    .header-menu-link {
        height: auto;
        padding: 16px 0;
        justify-content: space-between;
    }

    .header-menu-link::after {
        display: none;
    }

    .header-chevron {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .header-menu-item.is-open .header-chevron {
        transform: rotate(180deg);
    }

    .header-mega {
        position: static;
        display: none;
        opacity: 1;
        visibility: visible;
        transform: none;
        pointer-events: auto;
        border-bottom: 0;
        box-shadow: none;
        transition: none;
    }

    .header-menu-item.is-open .header-mega {
        display: block;
    }

    .header-mega-inner {
        display: block;
        padding: 0 0 16px;
    }

    .header-mega-title {
        display: none;
    }

    .header-mega-columns {
        display: block;
    }

    .header-mega-column {
        padding: 0;
        gap: 0;
        border-left: 0;
        background: #f8f8f8;
    }

    .header-mega-column li {
        padding: 0;
        border-bottom: 1px solid var(--header-line);
    }

    .header-mega-column a {
        display: block;
        padding: 18px 20px;
        font-size: 16px;
        color: var(--header-text);
    }
}
