/* =========================================================
   WEB BẾN CÁT — NAVIGATION MICRO-INTERACTIONS (OFFICIAL APPROVED)
   Bản chính thức được Owner phê duyệt:
   1. Golden Sliding Underline: Tốc độ 0.5x (450ms cubic-bezier)
   2. Soft Page Reveal: Tốc độ 0.5x (450ms fade-in + translateY 6px)
   3. View Transitions API (Cross-document MPA) + Progressive Enhancement
   4. Không hiển thị công cụ debug / floating switcher trên giao diện người dùng
   ========================================================= */

/* --- 1. View Transitions API (Cross-document MPA) ---
   Opt-in `@view-transition { navigation: auto; }` đã chuyển inline vào
   Views/Shared/_Layout.cshtml (ngay sau meta charset) để tránh race opt-in
   của Chromium 151+. File này chỉ giữ các rule hiệu ứng. */

/* Giữ ổn định tuyệt đối header và navigation trên mọi trình duyệt */
.site-header {
    view-transition-name: site-header;
}

::view-transition-group(site-header) {
    animation-duration: 0s !important;
}

/* Nội dung trang chuyển tiếp mềm mại theo tốc độ 0.5x duyệt bởi Owner */
#main-content {
    view-transition-name: page-main-content;
    animation: navPageEntrance 450ms cubic-bezier(0.16, 1, 0.3, 1) both;
    will-change: opacity, transform;
}

::view-transition-old(page-main-content) {
    animation: 300ms cubic-bezier(0.4, 0, 1, 1) both navPageExit;
}

::view-transition-new(page-main-content) {
    animation: 450ms cubic-bezier(0.16, 1, 0.3, 1) 40ms both navPageEntrance;
}

@keyframes navPageExit {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-4px);
    }
}

@keyframes navPageEntrance {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- 2. Golden Sliding Underline (Thanh gạch vàng trượt 450ms) --- */
.main-navigation__list {
    position: relative; /* Neo toạ độ chuẩn cho thanh trượt */
}

.nav-golden-underline {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, #d97706 0%, #f59e0b 50%, #fbbf24 100%);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.45);
    border-radius: 2px 2px 0 0;
    pointer-events: none;
    z-index: 10;
    opacity: 0;
    transform: translate3d(0, 0, 0);
    will-change: transform, width, opacity;
    transition:
        transform 450ms cubic-bezier(0.2, 0, 0, 1),
        width 450ms cubic-bezier(0.2, 0, 0, 1),
        opacity 300ms ease;
}

/* Khử gạch tĩnh cũ, đồng bộ viền trong suốt chống giật layout */
.public-shell .main-navigation a {
    border-bottom: 3px solid transparent !important;
    transition:
        color 250ms ease,
        background-color 250ms ease;
}

/* Nền tab chuyển sắc navy nhẹ nhàng khi rê chuột hoặc keyboard focus */
.public-shell .main-navigation a:hover,
.public-shell .main-navigation a:focus-visible {
    color: #ffffff !important;
    background-color: rgba(20, 53, 90, 0.55) !important;
    border-bottom-color: transparent !important;
}

/* Tab active có nhận diện nền rõ ràng */
.public-shell .main-navigation a.is-active {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.12) !important;
    border-bottom-color: transparent !important;
}

.public-shell .main-navigation a.is-active::after {
    display: none !important;
}

/* --- 3. Hỗ trợ Accessibility (prefers-reduced-motion) --- */
@media (prefers-reduced-motion: reduce) {
    .nav-golden-underline {
        transition: none !important;
    }

    #main-content,
    ::view-transition-group(*),
    ::view-transition-old(*),
    ::view-transition-new(*) {
        animation: none !important;
        transform: none !important;
        transition: none !important;
    }
}
