:root {
    --bg-dark: #050505;
    --bg-light: #121212;
    --text-main: #f5f5f7;
    --text-muted: #a1a1a6;
    --accent: #d32f2f;
    --accent-hover: #ff5252;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

h1, h2, h3 {
    font-weight: 600;
    letter-spacing: -0.02em;
}

h1 em, h2 em {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    color: var(--text-muted);
}

a {
    color: var(--text-main);
    text-decoration: none;
    transition: color 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 1.2rem 4rem;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    background: rgba(5, 5, 5, 0.85);
    backdrop-filter: blur(12px);
    z-index: 1000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

.logo {
    font-weight: 800;
    font-size: 1.8rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-align: center;
    line-height: 1;
}

.logo span {
    font-weight: 300;
    color: var(--text-muted);
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 2.5rem;
}

.nav-left {
    justify-content: flex-end;
    margin-right: 3rem;
}

.nav-right {
    justify-content: flex-start;
    margin-left: 3rem;
}

.nav-links a {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    padding: 0.3rem 0;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1px;
    background-color: var(--accent-hover);
    transition: width 0.3s ease;
}

.nav-links a:hover {
    color: var(--accent-hover);
}

.nav-links a:hover::after {
    width: 100%;
}

/* Hero Section */
.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    text-align: center;
    overflow: hidden;
}

.hero-video-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
    background: url('assets/hero_bg.png') center center / cover no-repeat;
}

.hero-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    opacity: 0.6;
    transform: scale(1.1); /* Tăng nhẹ tỷ lệ gốc để giấu viền đen */
    animation: slowZoom 25s infinite alternate ease-in-out; /* Chuyển động mượt hơn */
}

.hero-video.is-playing {
    opacity: 0.6;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, transparent 20%, var(--bg-dark) 100%),
                linear-gradient(to bottom, transparent 60%, var(--bg-dark) 100%);
    z-index: 2;
}

.hero-grain {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background-image: url('https://grainy-gradients.vercel.app/noise.svg');
    opacity: 0.15; /* Adjust for more or less grain */
    z-index: 1;
    pointer-events: none;
    animation: grain-animation 0.8s steps(10) infinite;
}

@keyframes grain-animation {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-5%, -10%); }
    20% { transform: translate(-15%, 5%); }
    30% { transform: translate(7%, -25%); }
    40% { transform: translate(-5%, 25%); }
    50% { transform: translate(-15%, 10%); }
    60% { transform: translate(15%, 0%); }
    70% { transform: translate(0%, 15%); }
    80% { transform: translate(3%, 35%); }
    90% { transform: translate(-10%, 10%); }
}

@keyframes slowZoom {
    0% { transform: scale(1.1); }
    100% { transform: scale(1.2); }
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    padding: 0 2rem;
}

.hero h1 {
    font-size: 4rem;
    margin-bottom: 1rem;
    line-height: 1.1;
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 2.5rem;
}

.cta-btn {
    display: inline-block;
    padding: 1rem 2.5rem;
    background: transparent;
    border: 1px solid var(--text-main);
    color: var(--text-main);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.cta-btn:hover {
    background: var(--text-main);
    color: var(--bg-dark);
}

/* About Section */
.about-section {
    padding: 8rem 0;
    background-color: var(--bg-dark);
}

.about-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.about-content h2 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
}

.about-content p {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    text-align: justify;
}

/* Section Header */
.section-header {
    text-align: center;
    margin-bottom: 4rem;
}

.section-header h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.section-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Showcase Section */
.showcase-section {
    padding: 8rem 0;
    background-color: var(--bg-light);
}

.slider-carousel {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    max-width: 1300px;
    margin: 0 auto;
    position: relative;
}

.carousel-nav {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.carousel-nav:hover {
    background: white;
    color: black;
    transform: scale(1.1);
}

.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 2rem;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;
}

.dot.active {
    background: white;
    transform: scale(1.3);
}

.carousel-viewport {
    flex-grow: 1;
    max-width: 1000px;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

.carousel-track {
    display: flex;
    transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.slider-container {
    position: relative;
    flex: 0 0 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
    cursor: col-resize;
    user-select: none;
}

.slider-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.img-background {
    position: absolute;
    top: 0;
    left: 0;
}

.img-foreground {
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    overflow: hidden;
}

.img-foreground img {
    width: 1000px;
    max-width: none;
    height: 100%;
    object-fit: cover;
}

@media (max-width: 1000px) {
    .img-foreground img {
        width: 100vw;
    }
}

.slider-handle {
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 100%;
    background-color: white;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 10;
}

.slider-button {
    width: 40px;
    height: 40px;
    background-color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    color: black;
}

.slider-button svg {
    width: 16px;
    height: 16px;
}

.label {
    position: absolute;
    top: 20px;
    padding: 5px 12px;
    background: rgba(0,0,0,0.6);
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 2px;
    border-radius: 4px;
    z-index: 5;
    pointer-events: none;
    backdrop-filter: blur(4px);
}

.label-before {
    right: 20px;
}

.label-after {
    left: 20px;
}

/* Gallery (Projects) */
.gallery-section {
    padding: 8rem 0;
    background-color: var(--bg-dark);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 3rem;
}

.project-item {
    background-color: var(--bg-light);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease;
    align-self: start;
}

.project-item:hover {
    transform: translateY(-5px);
}

.video-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background-color: #000;
}

.fb-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background-color: #000;
}

.video-container iframe, 
.video-container img,
.fb-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.fb-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.image-container {
    width: 100%;
    background-color: var(--bg-dark);
}

.image-container img {
    width: 100%;
    height: auto;
    display: block;
}

.thumbnail-link {
    display: block;
    position: relative;
}

.play-overlay {
    position: absolute;
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.thumbnail-link:hover .play-overlay {
    opacity: 1;
}

.thumbnail-link:hover img {
    transform: scale(1.05);
}

.project-info {
    padding: 2rem;
}

.project-info h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: var(--text-main);
}

.credits {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.8;
}

.credits strong {
    color: #ccc;
    font-weight: 600;
}

/* Footer */
.footer {
    padding: 6rem 0 3rem;
    background-color: var(--bg-light);
    border-top: 1px solid rgba(255,255,255,0.05);
}

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

.footer h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.footer p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.contact-details {
    margin-bottom: 3rem;
}

.email-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--text-main);
    padding-bottom: 5px;
}

.email-link:hover {
    color: var(--text-muted);
    border-color: var(--text-muted);
}

.phone-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.2rem;
    color: var(--text-main);
    margin-top: 1rem;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 4rem;
}

.social-links a {
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1px;
}

.copyright {
    font-size: 0.8rem;
    color: #555;
}

/* Category Selection */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-top: 3rem;
    margin-bottom: 4rem;
}

.category-card {
    position: relative;
    height: 180px;
    background-color: var(--bg-light);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.category-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.8), rgba(0,0,0,0.1));
    z-index: 1;
    transition: opacity 0.3s ease;
}

.category-card span {
    position: relative;
    z-index: 2;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    transition: transform 0.3s ease;
    text-shadow: 0 2px 15px rgba(0,0,0,0.8);
}

.category-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.6);
}

.category-card:hover::after {
    background: linear-gradient(to top, rgba(0,0,0,0.9), rgba(0,0,0,0.1));
}

.category-card.active {
    box-shadow: 0 0 50px rgba(255,255,255,0.1);
    transform: translateY(-8px) scale(1.05);
}

.category-card.active span {
    transform: scale(1.1);
    color: #fff;
    text-shadow: 0 0 15px rgba(255,255,255,0.5);
}

/* Backgrounds for categories */
.card-mv { background-image: url('https://img.youtube.com/vi/9WLb1qf2kK4/maxresdefault.jpg'); background-size: cover; background-position: center; }
.card-commercial { background-image: url('assets/projects/samsung_pay.jpg'); background-size: cover; background-position: center; }
.card-film { background-image: url('assets/projects/1.png'); background-size: cover; background-position: center; }
.card-others { background-image: url('assets/projects/CGCD SS2.jpg'); background-size: cover; background-position: center; }

/* Hide old filter */
.filter-container {
    display: none;
}

.project-filter option {
    background-color: var(--bg-dark);
    color: var(--text-main);
}

.project-item.hidden {
    display: none;
}

/* Project Detail Modal */
.project-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    overflow-y: auto;
    transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    padding: 6rem 2rem 4rem;
}

.project-modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-close {
    position: fixed;
    top: 2rem;
    right: 2rem;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.5);
    z-index: 2100;
    transition: all 0.3s ease;
}

.modal-close:hover {
    color: white;
    transform: rotate(90deg);
}

.modal-content {
    max-width: 1400px;
    margin: 0 auto;
}

.modal-video-wrapper {
    width: 100%;
    margin-bottom: 4rem;
    box-shadow: 0 30px 100px rgba(0,0,0,0.8);
}

.modal-video-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background-color: #050505;
}

.modal-video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.modal-info {
    max-width: 900px;
    margin: 0 auto;
}

#modalTitle {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 2rem;
    letter-spacing: -1px;
}

.modal-credits {
    font-size: 1.1rem;
    color: var(--text-muted);
    line-height: 1.8;
}

.modal-credits strong {
    color: white;
}

.modal-fallback {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.youtube-fallback-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    padding: 1rem 2rem;
    background-color: #ff0000;
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9rem;
    width: fit-content;
    transition: all 0.3s ease;
    box-shadow: 0 10px 20px rgba(255, 0, 0, 0.2);
}

.youtube-fallback-btn:hover {
    background-color: #cc0000;
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(255, 0, 0, 0.3);
}

.youtube-fallback-btn svg {
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

body.modal-open {
    overflow: hidden;
}

@media (max-width: 768px) {
    /* Navbar */
    .navbar {
        display: flex;
        flex-direction: column;
        gap: 0.8rem;
        padding: 1rem 1.5rem;
    }
    
    .logo {
        font-size: 1.4rem;
        margin: 0;
        order: 1;
    }
    
    .nav-links {
        gap: 1.2rem;
        justify-content: center;
        width: 100%;
    }
    
    .nav-left {
        order: 2;
        margin-right: 0;
    }
    
    .nav-right {
        order: 3;
        margin-left: 0;
    }

    /* General Spacing */
    .container {
        padding: 0 1.2rem;
    }

    .about-section,
    .showcase-section,
    .gallery-section {
        padding: 4rem 0;
    }

    .section-header {
        margin-bottom: 2.5rem;
    }

    .section-header h2,
    .about-content h2 {
        font-size: 2rem;
    }

    .section-header p,
    .about-content p {
        font-size: 0.95rem;
    }

    .about-content p {
        text-align: center;
    }

    /* Hero Section */
    .hero h1 {
        font-size: 2.4rem;
    }

    .hero p {
        font-size: 1rem;
        margin-bottom: 2rem;
    }

    .cta-btn {
        padding: 0.8rem 2rem;
        font-size: 0.8rem;
        letter-spacing: 1px;
    }

    /* Before/After Showcase Slider */
    .slider-carousel {
        gap: 0;
    }

    .carousel-nav {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        z-index: 100;
        width: 44px;
        height: 44px;
        background: rgba(0, 0, 0, 0.5);
        border: none;
        backdrop-filter: blur(4px);
    }

    .carousel-nav svg {
        width: 20px;
        height: 20px;
    }

    .carousel-nav.prev {
        left: 8px;
    }

    .carousel-nav.next {
        right: 8px;
    }

    .carousel-dots {
        margin-top: 1.5rem;
    }

    .label {
        top: 10px;
        padding: 4px 8px;
        font-size: 0.7rem;
        letter-spacing: 1px;
    }

    .label-before { right: 10px; }
    .label-after { left: 10px; }

    /* Category Cards Grid */
    .category-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
        margin-top: 2rem;
        margin-bottom: 2.5rem;
    }

    .category-card {
        height: 110px;
        border-radius: 8px;
    }

    .category-card span {
        font-size: 0.8rem;
        letter-spacing: 1px;
    }

    /* Gallery (Projects) Grid */
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .project-info {
        padding: 1.2rem;
    }

    .project-info h3 {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }

    .credits {
        font-size: 0.85rem;
    }

    /* Modal */
    #modalTitle { font-size: 1.8rem; }
    .project-modal { padding: 4rem 1rem 2rem; }
    .modal-video-wrapper { margin-bottom: 2rem; }

    /* Footer */
    .footer {
        padding: 4rem 0 2rem;
    }

    .footer h2 {
        font-size: 1.6rem;
    }

    .email-link {
        font-size: 1.15rem;
        word-break: break-all;
    }

    .phone-link {
        font-size: 1rem;
    }

    .social-links {
        gap: 1.2rem;
        flex-wrap: wrap;
        margin-bottom: 2.5rem;
    }
}
