/* =========================================
   PROJECT DETAIL - KUME DESIGN ASIA
   Hero 100vh with sticky title overlay
   
   BEHAVIOR (như video HBA):
   1. Load trang: Title fixed ở bottom viewport (thấy ngay)
   2. Scroll trong hero: Title vẫn fixed ở bottom
   3. Scroll qua hero: Title đi theo hero lên (absolute)
   ========================================= */

/* === GOOGLE FONTS === */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@100;300;400;500;600;700&display=swap');

/* === VARIABLES === */
:root {
    --primary-color: #b30000;
    --text-dark: #1a1a1a;
    --text-light: #666;
    --text-caption: #999;
    --bg-color: #fff;
    --spacing: 8px;
    --font-family: 'Montserrat', sans-serif;
}

/* === RESET === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* =============================================
   FIX #2: GLOBAL FONT - Montserrat
   Override all fonts including CMS inline styles
   ============================================= */
body,
html {
    font-family: var(--font-family) !important;
    font-weight: 300;
    color: var(--text-dark);
    background: var(--bg-color);
}

h1, h2, h3, h4, h5, h6,
p, span, a, li, div,
label, input, textarea, button,
th, td {
    font-family: var(--font-family) !important;
}

/* Override NotoSans và tất cả inline styles từ CMS */
* {
    font-family: var(--font-family) !important;
}

[style*="font-family"] {
    font-family: var(--font-family) !important;
}

[style*="NotoSans"],
[style*="noto"],
[style*="Noto"] {
    font-family: var(--font-family) !important;
}

/* === HEADER === */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    margin: 0 auto;
    width: 92%;
    max-width: 1920px;
    padding: 30px 0;
    z-index: 1000;
    pointer-events: none;
}

.header-logo {
    height: 40px;
    pointer-events: auto;
    filter: drop-shadow(0 0 5px rgba(255,255,255,1)); 
}

/* =============================================
   FIX #1: HERO - 100VH (không phải 120vh)
   ============================================= */
.project-hero {
    width: 100%;
    height: 100vh;
    position: relative;
    overflow: hidden;
    background: #000;
}

.project-hero__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    animation: heroFadeIn 1.2s ease forwards;
}

@keyframes heroFadeIn {
    to { opacity: 1; }
}

/* =============================================
   FIX #1: Hero Overlay - STICKY BEHAVIOR
   
   - Default: position: fixed at bottom of viewport
   - When hero scrolls out: position: absolute at bottom of hero
   - This creates the "sticky" effect seen in HBA video
   ============================================= */
.project-hero__overlay {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 92%;
    max-width: 1920px;
    margin: 0 auto;
    padding: calc(var(--spacing) * 5) calc(var(--spacing) * 4);
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.7) 0%,
        rgba(0, 0, 0, 0.3) 70%,
        transparent 100%
    );
    color: #fff;
    z-index: 100;
    opacity: 0;
    animation: overlayFadeIn 1s ease 0.3s forwards;
    transition: opacity 0.3s ease;
}

/* Khi scroll - overlay "dính" vào bottom của hero và scroll cùng */
.project-hero__overlay.is-sticky-to-hero {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding-left: 4%;
    padding-right: 4%;
}

/* Ẩn khi đã scroll qua hero */
.project-hero__overlay.is-hidden {
    opacity: 0;
    pointer-events: none;
}

@keyframes overlayFadeIn {
    to { opacity: 1; }
}

/* Hero Title - Layout giống HBA */
.hero-title {
    font-family: var(--font-family) !important;
    font-weight: 600;
    font-size: clamp(2rem, 5vw, 3.5rem);
    margin-bottom: calc(var(--spacing) * 2);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    color: #fff;
    letter-spacing: -0.02em;
    text-transform: uppercase;
}

/* Hero Meta - Horizontal layout giống HBA */
.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: calc(var(--spacing) * 6);
    font-size: 0.85rem;
    font-family: var(--font-family) !important;
}

.hero-meta-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.hero-meta-label {
    display: none; /* Ẩn label như HBA design */
}

.hero-meta-value {
    font-family: var(--font-family) !important;
    font-weight: 300;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.9;
}

/* === CONTAINER === */
.project-container {
    width: 92%;
    max-width: 1920px;
    margin: 0 auto;
    padding: 0;
}

/* === CONTENT SECTION === */
.project-content-section {
    padding: calc(var(--spacing) * 10) 0 calc(var(--spacing) * 6) 0;
    opacity: 0;
    transform: translateY(30px);
}

.project-content-section.visible {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.content-grid {
    display: block;
    width: 100%;
}

/* =============================================
   FIX #2: Description Font - Montserrat
   Override CMS inline styles
   ============================================= */
.content-description {
    font-family: var(--font-family) !important;
    font-size: 1.125rem !important;
    line-height: 1.8;
    color: var(--text-light);
    max-width: 100%;
}

.content-description * {
    font-family: var(--font-family) !important;
    white-space: normal !important;
}

.content-description [style] {
    font-family: var(--font-family) !important;
    font-size: 1.125rem !important;
}

.content-description p {
    font-family: var(--font-family) !important;
    font-size: 1.125rem !important;
    margin-bottom: calc(var(--spacing) * 3);
    white-space: normal !important;
}

.content-description h1,
.content-description h2,
.content-description h3,
.content-description h4,
.content-description h5,
.content-description h6 {
    font-family: var(--font-family) !important;
    font-weight: 600;
    margin-bottom: calc(var(--spacing) * 2);
    color: var(--text-dark);
}

.content-description ul,
.content-description ol,
.content-description li {
    font-family: var(--font-family) !important;
    font-size: 1.125rem !important;
}

.content-description a {
    font-family: var(--font-family) !important;
    color: var(--primary-color);
}

.content-description strong,
.content-description b {
    font-family: var(--font-family) !important;
    font-weight: 600;
}

.content-description em,
.content-description i {
    font-family: var(--font-family) !important;
}

.content-description span {
    font-family: var(--font-family) !important;
    font-size: 1.125rem !important;
    white-space: normal !important;
}

/* Project Info Table - HIDDEN on all screens */
.project-info-table {
    display: none !important;
}

/* === GALLERY === */
.project-gallery {
    width: 92%;
    max-width: 1920px;
    margin: 0 auto;
    padding: calc(var(--spacing) * 2) 0 calc(var(--spacing) * 10) 0;
}

/* Gallery Grid Pattern */
.gallery-masonry {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    opacity: 0;
    transform: translateY(20px);
}

.gallery-item.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 1s ease, transform 1s ease;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Default: 2 columns */
.gallery-item {
    grid-column: span 1;
    aspect-ratio: 16/9;
}

/* Full width items: 1, 4, 5, 8, 9, 12... (4n+1 and 4n) */
.gallery-item:nth-child(4n+1) {
    grid-column: 1 / -1;
    aspect-ratio: 21/9;
}

.gallery-item:nth-child(4n) {
    grid-column: 1 / -1;
    aspect-ratio: 21/9;
}

/* 2 column items: 2, 3, 6, 7, 10, 11... (4n+2 and 4n+3) */
.gallery-item:nth-child(4n+2),
.gallery-item:nth-child(4n+3) {
    grid-column: span 1;
    aspect-ratio: 16/9;
}

/* === MODERN LIGHTBOX === */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.98);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    opacity: 0;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.lightbox.active {
    display: flex;
    animation: lightboxFadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes lightboxFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.lightbox__content {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.lightbox__image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transform: scale(0.8);
    animation: imageZoomIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) 0.1s forwards;
}

@keyframes imageZoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Modern UI Controls */
.lightbox__close {
    position: fixed;
    top: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: #fff;
    font-size: 1.5rem;
    font-family: var(--font-family) !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10001;
}

.lightbox__close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: rotate(90deg);
}

.lightbox__nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: #fff;
    font-size: 1.5rem;
    font-family: var(--font-family) !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10001;
}

.lightbox__nav:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

.lightbox__prev {
    left: 30px;
}

.lightbox__next {
    right: 30px;
}

.lightbox__counter {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 0.9rem;
    font-family: var(--font-family) !important;
    font-weight: 300;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    padding: calc(var(--spacing) * 1.5) calc(var(--spacing) * 3);
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 10001;
}

/* =============================================
   FIX #2: FOOTER - Be Vietnam Pro Font
   ============================================= */
.site-footer {
    margin-top: calc(var(--spacing) * 12);
    background: #fff;
    border-top: 1px solid #eee;
    font-family: var(--font-family) !important;
}

.footer-top {
    max-width: 1920px;
    width: 92%;
    margin: 0 auto;
    padding: 40px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-nav ul {
    display: flex;
    gap: 60px;
    list-style: none;
}

.footer-nav a {
    font-family: var(--font-family) !important;
    font-weight: 300;
    font-size: 0.8rem;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-decoration: none;
    transition: all 0.3s ease;
}

.footer-nav a:hover {
    color: var(--primary-color);
}

.footer-logo-wrap {
    display: flex;
    align-items: center;
    height: 50px;
}

.footer-logo-line {
    width: 1px;
    height: 40px;
    background-color: #333;
    margin-right: 20px;
}

.footer-logo img {
    height: 40px;
    display: block;
}

.footer-bottom {
    background-color: #2b2b2b;
    color: #fff;
    padding: 20px 0;
}

.footer-bottom-content {
    max-width: 1920px;
    width: 92%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.copyright {
    font-family: var(--font-family) !important;
    font-weight: 100;
    font-size: 0.75rem;
}

.footer-links {
    display: flex;
    gap: 15px;
    opacity: 0.8;
}

.footer-links a {
    font-family: var(--font-family) !important;
    font-weight: 100;
    color: #fff;
    text-decoration: none;
    font-size: 0.75rem;
}

.footer-links a:hover {
    color: var(--primary-color);
}

.footer-links span {
    opacity: 0.3;
}

/* === SCROLL TO TOP === */
.scroll-to-top {
    position: fixed;
    bottom: 40px;
    right: 40px;
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-family: var(--font-family) !important;
    box-shadow: 0 4px 20px rgba(179, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 999;
}

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

.scroll-to-top:hover {
    background: #8a0000;
    transform: translateY(-5px);
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr;
        gap: calc(var(--spacing) * 6);
    }
    
    .gallery-masonry {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .gallery-item:nth-child(4n+1),
    .gallery-item:nth-child(4n) {
        grid-column: 1 / -1;
    }
    
    .hero-meta {
        gap: calc(var(--spacing) * 4);
    }
}

@media (max-width: 768px) {
    .project-hero {
        height: 100vh;
    }
    
    .project-hero__overlay {
        padding: calc(var(--spacing) * 4) calc(var(--spacing) * 3);
        width: 100%;
    }
    
    .hero-title {
        font-size: 1.75rem;
    }
    
    .hero-meta {
        gap: calc(var(--spacing) * 3);
        font-size: 0.75rem;
    }
    
    /* FIX: Ẩn label trên mobile - chỉ hiện value */
    .hero-meta-label {
        display: none !important;
    }
    
    .hero-meta-value {
        font-size: 0.75rem;
    }
    
    .project-container {
        padding: 0 calc(var(--spacing) * 2);
    }
    
    .project-content-section {
        padding: calc(var(--spacing) * 6) 0 calc(var(--spacing) * 2) 0;
    }
    
    .content-description {
        font-size: 1rem;
    }
    
    /* FIX: Ẩn project info table trên mobile - chỉ hiện description */
    .project-info-table {
        display: none !important;
    }
    
    .project-gallery {
        padding: calc(var(--spacing) * 2) 0 calc(var(--spacing) * 6) 0;
    }
    
    /* Mobile: all images 1 column */
    .gallery-masonry {
        grid-template-columns: 1fr;
    }
    
    .gallery-item,
    .gallery-item:nth-child(4n+1),
    .gallery-item:nth-child(4n),
    .gallery-item:nth-child(4n+2),
    .gallery-item:nth-child(4n+3) {
        grid-column: 1;
        aspect-ratio: 4/3;
    }
    
    .lightbox__close,
    .lightbox__nav {
        width: 45px;
        height: 45px;
    }
    
    .lightbox__close {
        top: 20px;
        right: 20px;
    }
    
    .lightbox__prev {
        left: 20px;
    }
    
    .lightbox__next {
        right: 20px;
    }
    
    .footer-top {
        flex-direction: column-reverse;
        gap: 30px;
        align-items: flex-start;
    }
    
    .footer-nav ul {
        flex-wrap: wrap;
        gap: 20px;
    }
    
    .footer-bottom-content {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .scroll-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
}

/* === NATIVE SCROLL === */
html {
    scroll-behavior: auto;
}

/* === PAGE LOAD === */
.l-wrapper {
    opacity: 1;
}
