/* VienBaoTon v4 Theme - Modern Heritage Design */

/* Base Styles */
:root {
    --brand-red: #7d1f1f;
    --bg-light: #F5F2ED;
    --text-dark: #3E2723;
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-dark);
    background-color: #F5F2ED;
    position: relative;
    line-height: 1.6;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image: url('../images/bg3.png');
    background-repeat: no-repeat;
    background-position: center center;
    background-size: 70%;
    opacity: 0.08;
    pointer-events: none;
}

.serif-text {
    font-family: 'Crimson Pro', serif;
}

/* Remove default focus ring from all interactive elements */
a, button, input, textarea, select, [role="button"], [tabindex] {
    outline: none;
}

a:focus, a:focus-visible, a:active,
button:focus, button:focus-visible, button:active,
input:focus, input:focus-visible, input:active,
textarea:focus, textarea:focus-visible, textarea:active,
select:focus, select:focus-visible, select:active,
[role="button"]:focus, [role="button"]:focus-visible, [role="button"]:active,
[tabindex]:focus, [tabindex]:focus-visible, [tabindex]:active {
    outline: none;
    box-shadow: none;
    --tw-ring-offset-shadow: 0 0 #0000;
    --tw-ring-shadow: 0 0 #0000;
}

/* Override Tailwind preflight focus-visible ring on buttons/inputs */
button:focus-visible,
[type="button"]:focus-visible,
[type="reset"]:focus-visible,
[type="submit"]:focus-visible,
[role="button"]:focus-visible,
input:focus,
input:focus-visible,
textarea:focus,
textarea:focus-visible,
select:focus,
select:focus-visible {
    outline: none;
    --tw-ring-inset: 0 0 #0000;
    --tw-ring-offset-width: 0px;
    --tw-ring-offset-shadow: 0 0 #0000;
    --tw-ring-shadow: 0 0 #0000;
    box-shadow: none;
}

/* Navigation */
.nav-link {
    transition: color 0.3s ease;
    position: relative;
    outline: none;
}

.nav-link:focus,
.nav-link:focus-visible,
.nav-link:active {
    outline: none;
    box-shadow: none;
    --tw-ring-offset-shadow: 0 0 #0000;
    --tw-ring-shadow: 0 0 #0000;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--brand-red);
    transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.nav-link:hover {
    color: var(--brand-red);
}

/* Desktop Dropdown Menu */
.group:hover > ul,
[class~="group/sub"]:hover > ul {
    display: block !important;
}

[class~="group/sub"]:hover > ul {
    margin-top: -2.5rem;
}

header nav ul ul {
    display: none;
    animation: fadeIn 0.15s ease-out;
}

header nav ul ul ul {
    margin-top: 0;
}

header nav > ul > li:hover > ul {
    display: block;
}

/* Hero Menu Submenu */
#hero-menu .group:hover > ul,
#hero-menu [class~="group/sub"]:hover > ul {
    display: block !important;
}

#hero-menu [class~="group/sub"]:hover > ul {
    margin-top: 0;
}

#hero-menu ul ul {
    display: none;
    animation: fadeIn 0.15s ease-out;
}

/* Dynamic Navigation Menu */
.dynamic-nav-container ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.dynamic-nav-container > ul {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.dynamic-nav-container > ul > li {
    position: relative;
}

.dynamic-nav-container > ul > li > a {
    padding: 0.5rem 0;
    display: block;
}

/* Dropdown menus */
.dynamic-nav-container ul ul {
    display: none;
    position: absolute;
    left: 0;
    top: 100%;
    background: white;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    border-top: 2px solid var(--brand-red);
    border-radius: 0 0 4px 4px;
    min-width: 240px;
    z-index: 50;
    animation: fadeIn 0.15s ease-out;
}

/* Sub-dropdown (level 3) */
.dynamic-nav-container ul ul ul {
    left: 100%;
    top: -2px;
    border-top: none;
    border-left: 2px solid var(--brand-red);
    border-radius: 4px;
    min-width: 190px;
}

/* Show dropdown on hover */
.dynamic-nav-container .group:hover > ul,
.dynamic-nav-container [class~="group/sub"]:hover > ul {
    display: block !important;
}

/* Menu item links */
.dynamic-nav-container ul ul li a {
    display: block;
    padding: 0.5rem 1rem;
    font-size: 11px;
    font-weight: 500;
    color: #374151;
    text-decoration: none;
    border-bottom: 1px solid #f3f4f6;
    transition: all 0.2s ease;
}

.dynamic-nav-container ul ul li a:hover {
    color: var(--brand-red);
    background-color: #f9f5f0;
}

/* Last item no border */
.dynamic-nav-container ul ul li:last-child > a {
    border-bottom: none;
}

/* Arrow icon for items with submenu */
.dynamic-nav-container ul ul li[class~="group/sub"] > a {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* FadeIn animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Nav */
.mobile-nav-overlay {
    backdrop-filter: blur(2px);
}

/* Cards & Shadows */
.card-shadow {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Prose Content Styling */
.prose {
    font-size: 1.1875rem;
    line-height: 1.75;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
    font-family: 'Crimson Pro', serif;
    font-weight: 700;
    color: var(--brand-red);
    margin-top: 2em;
    margin-bottom: 1em;
}

.prose h1 { font-size: 2.25rem; }
.prose h2 { font-size: 1.875rem; }
.prose h3 { font-size: 1.5rem; }
.prose h4 { font-size: 1.25rem; }

.prose p {
    margin-bottom: 1.5em;
}

.prose ul,
.prose ol {
    margin-bottom: 1.5em;
    padding-left: 1.5em;
}

.prose li {
    margin-bottom: 0.5em;
}

.prose a {
    color: var(--brand-red);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.prose a:hover {
    color: #5a1616;
}

.prose img {
    margin: 2em auto;
    border-radius: 0.5rem;
}

.prose blockquote {
    border-left: 4px solid var(--brand-red);
    padding-left: 1em;
    font-style: italic;
    color: #666;
}

/* Line Clamp Utility */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.pagination a,
.pagination span {
    padding: 0.5rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.25rem;
    text-decoration: none;
    color: var(--text-dark);
    transition: all 0.2s;
}

.pagination a:hover {
    border-color: var(--brand-red);
    color: var(--brand-red);
}

.pagination .active {
    background-color: var(--brand-red);
    color: white;
    border-color: var(--brand-red);
}

/* Tags */
.tags-list a {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: #f3f4f6;
    border-radius: 9999px;
    font-size: 0.875rem;
    color: var(--text-dark);
    text-decoration: none;
    transition: all 0.2s;
}

.tags-list a:hover {
    background-color: var(--brand-red);
    color: white;
}

/* Search Page */
.search-item:hover .search-item-title {
    color: var(--brand-red);
}

/* Training Page */
.course-card:hover .course-title {
    color: #5a1616;
}

/* Album Page */
.photo-item:hover .photo-caption {
    color: var(--brand-red);
}

/* Timeline */
@media (max-width: 768px) {
    .timeline-item {
        padding-left: 2.5rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

.animate-slide-up {
    animation: slideUp 0.4s ease-out;
}

/* Print Styles */
@media print {
    .site-header,
    .site-footer,
    .mobile-nav-overlay,
    .mobile-nav-panel {
        display: none !important;
    }

    .site-main {
        padding: 0 !important;
    }

    a {
        text-decoration: none !important;
    }
}

/* Ghost Content Classes (kg-classes) */
.kg-width-wide {
    max-width: 1200px;
    margin: 2rem auto;
}

.kg-width-full {
    max-width: 100%;
    margin: 2rem 0;
}

.kg-width-full img {
    width: 100%;
    height: auto;
}

.kg-align-center {
    text-align: center;
}

.kg-image {
    max-width: 100%;
    height: auto;
}

.kg-image-card {
    margin: 2rem 0;
}

.kg-image-card img {
    border-radius: 0.5rem;
}

.kg-blockquote {
    border-left: 4px solid var(--brand-red);
    padding-left: 1.5rem;
    font-style: italic;
    color: #555;
    margin: 2rem 0;
}

.kg-bookmark-card {
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin: 2rem 0;
}

.kg-bookmark-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.kg-bookmark-title {
    font-weight: 600;
    color: var(--brand-red);
}

.kg-bookmark-description {
    color: #666;
    font-size: 0.875rem;
}

.kg-bookmark-thumbnail img {
    border-radius: 0.25rem;
    margin-top: 1rem;
}

/* Gallery native kiểu Ghost: mỗi hàng là flex, ảnh chia đều theo tỉ lệ */
.kg-gallery-card {
    margin: 2rem 0;
}

.kg-gallery-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.kg-gallery-row {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 0.75rem;
}

.kg-gallery-image {
    flex: 1 0 0;
}

.kg-gallery-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0.5rem;
    cursor: zoom-in;
}

.kg-image-card img {
    cursor: zoom-in;
}

/* Lightbox carousel — đồng bộ phong cách v4 */
.vbt-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(245, 242, 237, 0.82);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    animation: vbt-fade 0.2s ease;
}
@keyframes vbt-fade { from { opacity: 0; } to { opacity: 1; } }

/* Panel modal nổi — không full màn hình */
.vbt-lb-modal {
    position: relative;
    width: 100%;
    max-width: 960px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    background-color: rgba(255, 255, 255, 0.55);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    border: 1px solid #E8DFD0;
    border-radius: 0.75rem;
    padding: 1.25rem 1.25rem 1rem;
    box-shadow: 0 20px 60px rgba(62, 39, 35, 0.3);
    overflow: hidden;
    animation: vbt-modal-in 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes vbt-modal-in {
    from { opacity: 0; transform: translateY(18px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
/* Hình nền di tích giống bài viết, nhưng nhỏ hơn */
.vbt-lb-modal::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url('../images/bg3.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: 42%;
    opacity: 0.18;
    pointer-events: none;
    z-index: 0;
}
.vbt-lb-modal > * {
    position: relative;
    z-index: 1;
}

/* Hàng thương hiệu: logo + thông tin viện (như header) + nút đóng */
.vbt-lb-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(232, 223, 208, 0.8);
}
.vbt-lb-brand-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
}
.vbt-lb-logo {
    height: 2rem;
    width: auto;
    flex: 0 0 auto;
}
.vbt-lb-brand-text {
    line-height: 1.15;
    min-width: 0;
}
.vbt-lb-ministry {
    font-size: 0.55rem;
    color: var(--brand-red);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 0.1rem;
}
.vbt-lb-inst {
    font-family: 'Crimson Pro', serif;
    color: var(--brand-red);
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: -0.01em;
    line-height: 1.1;
}
.vbt-lb-inst-en {
    font-size: 0.55rem;
    color: #9a8b78;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-top: 0.05rem;
}

/* Tên bài viết */
.vbt-lb-title {
    font-family: 'Crimson Pro', serif;
    color: var(--text-dark);
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.3;
    padding: 0.5rem 0 0.25rem;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.vbt-lb-close {
    flex: 0 0 auto;
    color: #F5F2ED;
    font-size: 1.5rem;
    line-height: 1;
    background: var(--brand-red);
    border: none;
    cursor: pointer;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.vbt-lb-close:hover { background: #5e1717; }

.vbt-lb-stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0;
}
.vbt-lb-stage img {
    max-width: 100%;
    max-height: 58vh;
    object-fit: contain;
    border-radius: 0.5rem;
    box-shadow: 0 8px 24px rgba(62, 39, 35, 0.25);
    transition: opacity 0.2s ease;
}

.vbt-lb-caption {
    color: var(--text-dark);
    font-family: 'Crimson Pro', serif;
    font-style: italic;
    font-size: 0.95rem;
    margin-top: 0.5rem;
    text-align: center;
    max-width: 100%;
    min-height: 1.25rem;
}

.vbt-lb-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    color: #F5F2ED;
    font-size: 1.75rem;
    line-height: 1;
    background: var(--brand-red);
    border: 1px solid var(--brand-red);
    cursor: pointer;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(62, 39, 35, 0.25);
    transition: background 0.2s, transform 0.2s;
}
.vbt-lb-nav:hover { background: #5e1717; transform: translateY(-50%) scale(1.05); }
.vbt-lb-prev { left: 0.25rem; }
.vbt-lb-next { right: 0.25rem; }

.vbt-lb-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.vbt-lb-count {
    font-family: 'Crimson Pro', serif;
    color: #F5F2ED;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    background: var(--brand-red);
    padding: 0.15rem 0.85rem;
    border-radius: 9999px;
}
.vbt-lb-thumbs {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    max-width: 100%;
    padding: 0.25rem 0.5rem;
    scrollbar-width: thin;
}
.vbt-lb-thumb {
    flex: 0 0 auto;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 0.25rem;
    object-fit: cover;
    cursor: pointer;
    opacity: 0.6;
    border: 2px solid transparent;
    transition: opacity 0.2s, border-color 0.2s;
}
.vbt-lb-thumb:hover { opacity: 0.9; }
.vbt-lb-thumb.active {
    opacity: 1;
    border-color: var(--brand-red);
}

@media (max-width: 640px) {
    .vbt-lightbox { padding: 1rem; }
    .vbt-lb-modal { max-height: 92vh; padding: 1rem 0.75rem; }
    .vbt-lb-title { font-size: 1rem; -webkit-line-clamp: 1; }
    .vbt-lb-nav { width: 2.25rem; height: 2.25rem; font-size: 1.4rem; }
    .vbt-lb-stage img { max-height: 46vh; }
    .vbt-lb-thumb { width: 2.75rem; height: 2.75rem; }
}

.kg-card-figcaption {
    text-align: center;
    font-size: 0.875rem;
    color: #666;
    margin-top: 0.5rem;
}

.kg-header-card {
    text-align: center;
    padding: 4rem 2rem;
    background: linear-gradient(135deg, #f9f5f0 0%, #fff 100%);
    border-radius: 0.5rem;
    margin: 2rem 0;
}

.kg-header-card h2 {
    font-size: 2rem;
    color: var(--brand-red);
    margin-bottom: 1rem;
}

.kg-header-card p {
    color: #666;
    font-size: 1.125rem;
}

.kg-button-card {
    text-align: center;
    margin: 2rem 0;
}

.kg-button-card a {
    display: inline-block;
    padding: 0.75rem 2rem;
    background-color: var(--brand-red);
    color: white;
    text-decoration: none;
    border-radius: 0.25rem;
    font-weight: 600;
    transition: background-color 0.2s;
}

.kg-button-card a:hover {
    background-color: #5a1616;
}

.kg-file-card {
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
    margin: 1rem 0;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.kg-file-card a {
    color: var(--brand-red);
    text-decoration: none;
    font-weight: 500;
}

.kg-file-card-figcaption {
    font-size: 0.875rem;
    color: #666;
}

.kg-toggle-card {
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    margin: 1rem 0;
}

.kg-toggle-card[data-is-closed="true"] .kg-toggle-content {
    display: none;
}

.kg-toggle-heading {
    padding: 1rem;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kg-toggle-content {
    padding: 0 1rem 1rem;
}

.kg-product-card {
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin: 2rem 0;
}

.kg-product-card-image {
    margin-bottom: 1rem;
}

.kg-product-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--brand-red);
}

.kg-product-card-description {
    color: #666;
    margin: 0.5rem 0;
}

.kg-product-card-price {
    font-weight: 600;
    color: var(--brand-red);
    margin: 0.5rem 0;
}

.kg-product-card-button {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: var(--brand-red);
    color: white;
    text-decoration: none;
    border-radius: 0.25rem;
    margin-top: 1rem;
}
