/* ==============================================================================
   RESPONSIVE STYLES - ULTRA MOBILE OPTIMIZATION SYSTEM (SIÊU TỐI ƯU DI ĐỘNG)
   Tailored for iOS & Android (iPhone Dynamic Island, Samsung, iPad, Tablets)
   ============================================================================== */

/* --- 1. GLOBAL TOUCH & MOBILE OPTIMIZATIONS --- */
html, body {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

button, a, .filter-tab, .gallery-item {
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

/* --- 2. TABLET SCREENS (<= 991px) --- */
@media (max-width: 991px) {
    :root {
        --header-height: 70px;
        --section-padding-y: 60px;
    }

    .site-header {
        height: var(--header-height);
        padding-top: env(safe-area-inset-top, 0px);
    }

    /* Mobile Drawer Menu */
    .site-header.menu-open {
        background-color: #ffffff !important;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    }

    .site-header.menu-open .brand-title {
        color: #111111 !important;
    }

    .site-header.menu-open .brand-tagline {
        color: #888888 !important;
    }

    .site-header.menu-open .mobile-toggle span {
        background-color: #111111 !important;
    }

    .nav-desktop {
        position: fixed;
        top: var(--header-height);
        left: 0;
        width: 100%;
        background-color: #ffffff;
        border-bottom: 1px solid var(--border-subtle);
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
        flex-direction: column;
        align-items: center;
        padding: 24px 20px 32px;
        gap: 8px;
        transform: translateY(-120%);
        opacity: 0;
        pointer-events: none;
        transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
        z-index: var(--z-sticky);
    }

    .nav-desktop.mobile-open {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }

    /* Đảm bảo chữ menu luôn màu ĐEN ĐẬM rõ nét trên nền trắng */
    .site-header .nav-desktop .nav-link,
    .site-header.transparent .nav-desktop .nav-link,
    .site-header.scrolled .nav-desktop .nav-link {
        color: #111111 !important;
        font-size: 13.5px !important;
        font-weight: 700 !important;
        letter-spacing: 2.5px;
        padding: 12px 16px;
        width: 100%;
        text-align: center;
        border-bottom: 1px solid rgba(0, 0, 0, 0.06);
        transition: background-color 0.2s ease, color 0.2s ease;
    }

    .site-header .nav-desktop .nav-link:last-child {
        border-bottom: none;
    }

    .site-header .nav-desktop .nav-link:hover,
    .site-header .nav-desktop .nav-link.active,
    .site-header.transparent .nav-desktop .nav-link.active {
        color: #000000 !important;
        background-color: rgba(0, 0, 0, 0.04);
    }

    .site-header .nav-desktop .nav-link::after {
        display: none !important;
    }

    .mobile-toggle {
        display: flex;
    }

    .mobile-toggle.active span:nth-child(1) {
        transform: translateY(6.5px) rotate(45deg);
    }

    .mobile-toggle.active span:nth-child(2) {
        transform: translateY(-6.5px) rotate(-45deg);
    }

    .portfolio-filter-section {
        top: var(--header-height);
    }

    .hero-slide-content {
        padding-top: var(--header-height);
        padding-left: 20px;
        padding-right: 20px;
    }

    .hero-title {
        font-size: clamp(28px, 6vw, 42px);
    }

    .pricing-grid {
        display: block;
        width: 100%;
        margin-top: 28px;
    }
}

/* --- 3. SMARTPHONES & MOBILE SCREENS (<= 768px) --- */
@media (max-width: 768px) {
    :root {
        --header-height: 64px;
        --gallery-gap: 5px;
        --section-padding-y: 44px;
        --section-padding-x: 12px;
    }

    /* 🎯 FULL 100% TRANG BÌA TOÀN MÀN HÌNH ĐIỆN THOẠI (100svh / 100vh) */
    .hero-slider-section {
        height: 100vh;
        height: 100svh;
        min-height: 100svh;
        max-height: none;
    }

    /* Slide 1: Focus chính xác vào gương mặt nàng thơ góc phải */
    .hero-slide:nth-child(1) .hero-slide-bg {
        background-position: 84% 38% !important;
        background-size: cover;
    }

    /* Slide 2: Focus chính xác vào gương mặt và cánh bướm góc phải */
    .hero-slide:nth-child(2) .hero-slide-bg {
        background-position: 78% 42% !important;
        background-size: cover;
    }

    /* Lớp phủ chuyển màu gradient nhẹ nhàng ở phần mặt, tối đậm ở phần chữ dưới */
    .hero-slide-overlay {
        background: linear-gradient(to top, rgba(0, 0, 0, 0.92) 0%, rgba(0, 0, 0, 0.55) 45%, rgba(0, 0, 0, 0.1) 70%, rgba(0, 0, 0, 0.4) 100%) !important;
    }

    .hero-slide-content {
        justify-content: flex-end;
        padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
        padding-left: 20px;
        padding-right: 20px;
        max-width: 100%;
    }

    .hero-tag {
        font-size: 10px;
        letter-spacing: 2.2px;
        margin-bottom: 8px;
    }

    .hero-title {
        font-size: clamp(21px, 5.8vw, 25px);
        letter-spacing: 1px;
        line-height: 1.25;
        margin-bottom: 12px;
        text-wrap: balance;
        word-break: keep-all;
    }

    .hero-desc {
        font-size: 13px;
        line-height: 1.6;
        margin-bottom: 22px;
        max-width: 100%;
        text-wrap: balance;
        display: block;
    }

    .hero-cta-group {
        gap: 10px;
        width: 100%;
        flex-wrap: nowrap;
    }

    .hero-btn {
        flex: 1;
        padding: 12px 14px;
        font-size: 11px;
        letter-spacing: 1.2px;
        text-align: center;
        white-space: nowrap;
    }

    .hero-nav-arrow {
        display: none; /* Ẩn nút mũi tên to trên mobile, ưu tiên vuốt Touch Swipe */
    }

    .hero-dots {
        bottom: calc(18px + env(safe-area-inset-bottom, 0px));
        gap: 8px;
    }

    .hero-dot {
        width: 20px;
        height: 3px;
    }

    .hero-dot.active {
        width: 36px;
    }

    /* Header Icons */
    .header-social-icons {
        gap: 6px;
    }

    .header-icon-btn {
        width: 28px;
        height: 28px;
        font-size: 11.5px;
    }

    .brand-title {
        font-size: 15px;
        letter-spacing: 2.5px;
    }

    .brand-tagline {
        font-size: 7.5px;
        letter-spacing: 1.5px;
    }

    /* Horizontal Filter Tabs Scroll Momentum */
    .portfolio-filter-section {
        padding: 10px 0;
    }

    .filter-tabs-wrapper {
        justify-content: flex-start;
        padding: 2px 14px;
        gap: 14px;
        -webkit-overflow-scrolling: touch;
    }

    .filter-tab {
        font-size: 11px;
        letter-spacing: 1.5px;
        padding: 6px 6px;
        flex-shrink: 0;
    }

    /* 🎯 LƯỚI ẢNH CONCEPT CHUYÊN NGHIỆP TRÊN DI ĐỘNG: KHÔNG LỆCH KHUNG & TRẢI DÀI HẾT TRANG WEB */
    .gallery-section {
        padding-top: 16px;
        padding-bottom: 40px;
    }

    .gallery-section .container.gallery-container-fluid {
        padding-left: 5px !important;
        padding-right: 5px !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    /* 🎯 DẠNG Ô LƯỚI 2 CỘT GỌN GÀNG TRÊN DI ĐỘNG (XEM NHANH NHIỀU CONCEPT, ĐỠ PHẢI LƯỚT NHIỀU) */
    .masonry-gallery {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        column-count: auto !important;
        gap: 6px !important;
        width: 100% !important;
    }

    .gallery-item {
        margin-bottom: 0 !important;
        width: 100% !important;
        background-color: #1a1a1a !important;
        overflow: hidden !important;
        position: relative !important;
        cursor: pointer !important;
        border-radius: 3px !important;
    }

    .gallery-image-wrapper {
        width: 100% !important;
        aspect-ratio: 2 / 3 !important; /* TỶ LỆ DỌC CHUẨN 2:3 CỦA MÁY ẢNH STUDIO - GIỮ NGUYÊN BỐ CỤC ĐỨNG */
        overflow: hidden !important;
        position: relative !important;
    }

    .gallery-image {
        width: 100% !important;
        height: 100% !important;
        display: block !important;
        object-fit: cover !important;
        object-position: center top !important; /* Lấy chuẩn gương mặt và ngọn tóc, không bao giờ bị cắt cúp */
        border-radius: 3px !important;
        transition: transform 0.4s ease !important;
    }

    /* Bỏ hoàn toàn chữ che ảnh ở giữa - giữ trọn vẹn vẻ đẹp của từng bức hình */
    .gallery-overlay {
        display: none !important;
    }

    /* Pricing Section: Ẩn bảng so sánh dạng table bị chật hẹp trên điện thoại, hiển thị Thẻ chi tiết + Tabs cao cấp */
    .pricing-grid {
        display: block;
        width: 100%;
        margin-top: 20px;
    }

    .pricing-matrix-wrapper {
        display: none !important;
    }

    .pricing-mobile-wrapper {
        display: block !important;
    }

    /* 🎯 CÂN ĐỐI TIÊU ĐỀ & MÔ TẢ TRÊN DI ĐỘNG (CHỐNG RỚT CHỮ CÔ ĐƠN) */
    .section-header {
        margin-bottom: 28px;
    }

    .section-title {
        font-size: clamp(20px, 5.5vw, 25px);
        letter-spacing: 1.2px;
        line-height: 1.3;
        text-wrap: balance;
        word-break: keep-all;
    }

    .section-subtitle {
        font-size: 13px;
        line-height: 1.6;
        max-width: 92%;
        margin: 0 auto;
        text-wrap: balance;
    }

    .about-quote {
        font-size: clamp(17px, 4.5vw, 22px);
        line-height: 1.6;
        padding: 0 8px;
        text-wrap: balance;
        word-break: keep-all;
    }

    .pricing-notes-title {
        font-size: 20px;
        letter-spacing: 1.2px;
        text-wrap: balance;
        word-break: keep-all;
    }

    .pricing-notes-subtitle {
        font-size: 13px;
        line-height: 1.6;
        text-wrap: balance;
    }

    /* Fullscreen Mobile Lightbox */
    .lightbox-modal {
        background-color: rgba(0, 0, 0, 0.98);
    }

    .lightbox-content-wrapper {
        max-width: 100vw;
        max-height: 100dvh;
        width: 100%;
        height: 100%;
        padding: env(safe-area-inset-top, 20px) 10px env(safe-area-inset-bottom, 20px);
    }

    .lightbox-main-img {
        max-width: 96vw;
        max-height: 75dvh;
        box-shadow: none;
    }

    .lightbox-info {
        margin-top: 10px;
    }

    .lightbox-title {
        font-size: 13px;
    }

    .lightbox-meta {
        font-size: 11px;
    }

    .lightbox-close {
        top: max(12px, env(safe-area-inset-top, 12px));
        right: 14px;
        font-size: 26px;
        padding: 8px;
    }

    .lightbox-btn {
        padding: 8px;
        font-size: 24px;
    }

    .lightbox-prev { left: 4px; }
    .lightbox-next { right: 4px; }

    /* Footer on Mobile */
    .site-footer {
        padding: 30px 0 calc(30px + env(safe-area-inset-bottom, 0px));
    }

    .footer-inner {
        flex-direction: column;
        text-align: center;
        gap: 16px;
    }

    .footer-socials {
        flex-wrap: wrap;
        justify-content: center;
        gap: 14px;
    }
}

/* --- 4. SMALL PHONES (<= 380px) --- */
@media (max-width: 380px) {
    .brand-title {
        font-size: 13.5px;
        letter-spacing: 1.8px;
    }

    .brand-tagline {
        display: none;
    }

    .hero-title {
        font-size: 20px;
    }

    .hero-btn {
        padding: 10px 8px;
        font-size: 10px;
    }
}
