/* Font AktifoB */
@font-face {
    font-family: 'AktifoB';
    src: url('../fonts/AktifoB-Book.otf') format('opentype'),
         url('../fonts/AktifoB-Book.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

:root {
    /* Colors System */
    --c-primary: #0099FF;
    --c-secondary: #FFC72C;
    --c-tertiary: #D4E9F5;
    --c-accent: #FF6B00;
    --c-dark: #20252B;
    --c-light: #F8F9FA;
    --c-white: #FFFFFF;
    --c-black: #000000;

    /* Typography Scale */
    --font-primary: 'Mona Sans', sans-serif;
    --text-xs: 10px;
    --text-sm: 12px;
    --text-base: 14px;
    --text-md: 16px;
    --text-lg: 18px;
    --text-xl: 20px;
    --text-2xl: 24px;
    --text-3xl: 32px;
    --text-4xl: 40px;
    --text-5xl: 48px;
    --text-6xl: 64px;
    --text-7xl: 72px;
    --text-8xl: 100px;

    /* Spacing Scale (Margin/Padding) */
    --space-2xs: 4px;
    --space-xs: 5px;
    --space-sm: 10px;
    --space-md: 20px;
    --space-lg: 30px;
    --space-xl: 40px;
    --space-2xl: 60px;
    --space-3xl: 80px;
    --space-4xl: 120px;
    --space-5xl: 150px;

    /* Grid & Layout Metrics - Mobile first */
    --grid-gap: var(--space-xs);
    --padding-container: var(--space-sm);

    --border-width: 2px;
    --radius-sm: 2px;
    --radius-md: 4px;
    --radius-lg: 8px;
}

@media (min-width: 1024px) {
    :root {
        /* Desktop override: 10px/20px grid system */
        --grid-gap: var(--space-sm);
        --padding-container: var(--space-md);
    }
}

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
}
html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-primary);
    background-color: var(--c-white);
    position: relative;
    display: flex;
    flex-direction: column;
}

/* =========================================
   LAYOUT COMPONENTS
========================================= */
.main-wrapper {
    flex-grow: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    background-color: transparent;
}

.floating-header-wrapper {
    position: absolute;
    top: var(--space-md);
    left: var(--space-md);
    right: var(--space-md);
    z-index: 50;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.floating-header-wrapper.is-hidden {
    transform: translateY(calc(-100% - var(--space-md) - 10px));
    opacity: 0;
    pointer-events: none;
}

.content-overlay-wrapper {
    position: absolute;
    top: auto;
    bottom: var(--space-xl);
    left: 0;
    z-index: 10;
    width: 100%;
    padding-left: var(--padding-container);
    padding-right: var(--padding-container);
}

/* --- Floating Header Elements --- */
.header-left {
    display: flex;
    flex-direction: column;
    gap: var(--space-2xs);
}

.header-left-box {
    background: var(--c-white);
    padding: var(--space-2xs) var(--space-sm);
    border-radius: var(--radius-md);
}

.header-right {
    display: flex;
    gap: var(--space-2xs);
    align-items: flex-start;
    width: 100%;
}

.nav-item {
    background: var(--c-white);
    padding: var(--space-sm);
    font-size: var(--text-base);
    border-radius: var(--radius-sm);
    color: var(--c-primary);
    text-decoration: none;
    transition: all 0.3s ease;
    flex: 1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-item:hover {
    background: var(--c-primary);
    color: var(--c-white);
}

/* =========================================
   COLORS UTILITIES
========================================= */
.text-primary { color: var(--c-primary); }
.text-secondary { color: var(--c-secondary); }
.text-tertiary { color: var(--c-tertiary); }
.text-accent { color: var(--c-accent); }
.text-dark { color: var(--c-dark); }
.text-light { color: var(--c-light); }

.bg-primary { background-color: var(--c-primary); }
.bg-secondary { background-color: var(--c-secondary); }
.bg-tertiary { background-color: var(--c-tertiary); }
.bg-accent { background-color: var(--c-accent); }
.bg-dark { background-color: var(--c-dark); }
.bg-light { background-color: var(--c-light); }

/* =========================================
   GRID SYSTEM (Mobile 4 cols / Desktop 12 cols)
========================================= */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding-left: var(--padding-container);
    padding-right: var(--padding-container);
}

.row {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--grid-gap);
    width: 100%;
}

/* Mobile defaults (stacking) */
.col-1, .col-2, .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9, .col-10, .col-11, .col-12 {
    grid-column: span 4;
}

/* Mobile specific columns */
@media (max-width: 1023px) {
    .row {
        grid-template-columns: repeat(4, 1fr);
    }
    .m-col-1 { grid-column: span 1; }
    .m-col-2 { grid-column: span 2; }
    .m-col-3 { grid-column: span 3; }
    .m-col-4 { grid-column: span 4; }

    .hide-on-mobile {
        display: none !important;
    }
}

@media (min-width: 1024px) {
    .content-overlay-wrapper {
        top: 50%;
        bottom: auto;
        transform: translateY(-50%);
    }

    .row {
        grid-template-columns: repeat(12, 1fr);
    }
    .col-1 { grid-column: span 1; }
    .col-2 { grid-column: span 2; }
    .col-3 { grid-column: span 3; }
    .col-4 { grid-column: span 4; }
    .col-5 { grid-column: span 5; }
    .col-6 { grid-column: span 6; }
    .col-7 { grid-column: span 7; }
    .col-8 { grid-column: span 8; }
    .col-9 { grid-column: span 9; }
    .col-10 { grid-column: span 10; }
    .col-11 { grid-column: span 11; }
    .col-12 { grid-column: span 12; }
}

/* =========================================
   UTILITIES
========================================= */
@media (max-width: 1023px) {
    .hide-on-mobile {
        display: none !important;
    }
    .big-text-indent {
        text-indent: calc(25% + var(--grid-gap));
        text-align: left !important;
    }
    .m-text-indent {
        padding-left: calc(25% + var(--grid-gap));
    }
}

@media (min-width: 1024px) {
    .big-text-indent {
        text-indent: calc(16.666% + var(--grid-gap));
    }
}

/* Scrollbar Hide */
html, body, .hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
html::-webkit-scrollbar, body::-webkit-scrollbar, .hide-scrollbar::-webkit-scrollbar {
    display: none;
}

/* =========================================
   GRID 6x6 SYSTEM
========================================= */
.grid-6x6-wrapper {
    height: 100vh;
    padding: var(--space-md);
    background-color: var(--c-white);
}

/* HIDE MOBILE ELEMENTS ON DESKTOP EXPLICITLY */
@media (min-width: 1024px) {
    .header-mobile, #mobile-menu {
        display: none !important;
    }
}

.grid-6x6 {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(6, 1fr);
    gap: var(--space-md);
    width: 100%;
    height: 100%;
}

/* RESPONSIVE MOBILE & IPAD (Dưới 1024px) */
@media (max-width: 1023px) {
    /* Global button mobile scale-down */
    .digifi-btn {
        font-size: 12px !important;
        padding: 4px 4px 4px 12px !important;
    }
    /* 1. Lề và khoảng cách giảm từ 20px xuống 10px */
    :root {
        --space-md: 10px !important;
    }

    /* Đảm bảo padding 10px thay vì 40px hoặc 5vw ở các component cứng */
    .loader-grid { padding: 10px !important; }
    
    #loader-counter {
        top: 10px !important;
    }

    /* 2. Ép lưới 6 cột thành 4 cột một cách an toàn */
    .grid-6x6, [style*="repeat(6, 1fr)"] {
        grid-template-columns: repeat(4, 1fr) !important;
    }

    /* 3. Xử lý phần chữ to ở đầu trang (Hero) và Text sizes */
    /* Giảm cỡ chữ toàn cục trên mobile */
    .hero-text { font-size: 56px !important; }
    [style*="font-size: 56px"] { font-size: 36px !important; }
    [style*="font-size: 32px"] { font-size: 24px !important; }
    [style*="font-size: 24px"] { font-size: 18px !important; }
    
    .big-text-left, 
    .showreel-wrapper {
        grid-column: 1 / -1 !important; /* Full chiều ngang 4 cột */
        justify-content: center !important;
        padding: 0 !important;
    }
    
    /* Header mobile layout */
    .header-desktop {
        display: none !important;
    }
    .header-mobile {
        display: flex !important;
    }
    .header-mobile.hidden {
        display: flex !important; /* Override hidden class from tailwind on mobile */
    }

    .big-text-right {
        display: none !important;
    }
    
    .big-text-svg {
        height: auto !important;
        width: 80% !important;
        margin-bottom: 20px !important;
    }

    .pos-desc {
        grid-column: 1 / -1 !important;
        padding-top: 20px !important;
    }
    
    .pos-scroll {
        grid-column: 1 / span 2 !important;
    }

    /* Fix About Section on mobile to fit in 1 screen and use 4 columns */
    .about-wrapper {
        height: auto !important;
        min-height: 100vh !important;
        overflow: visible !important;
        padding: 10px !important;
    }
    .about-wrapper .grid-6x6 {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        grid-template-rows: repeat(6, 1fr) !important;
        gap: 16px !important;
        height: 100% !important;
    }
    .about-wrapper .about-heading {
        grid-column: 1 / span 4 !important;
        grid-row: 1 / span 1 !important;
        align-self: end !important;
        font-size: 32px !important;
        margin: 0 !important;
        text-align: center !important;
    }
    .about-wrapper .about-bottom-wrapper {
        grid-column: 1 / -1 !important;
        grid-row: 3 / span 4 !important;
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 16px !important;
        margin: 0 !important;
    }
    .about-wrapper .about-label {
        grid-column: 1 / span 1 !important;
        font-size: 16px !important;
    }
    .about-wrapper .about-paragraphs {
        grid-column: 2 / span 3 !important;
        font-size: 20px !important;
        gap: 16px !important;
    }
    .about-wrapper .about-paragraphs p {
        font-size: 20px !important;
        line-height: 1.3 !important;
    }
    .about-wrapper .digifi-btn {
        font-size: 12px !important;
        padding: 4px 4px 4px 12px !important;
    }
    .about-logo-static {
        display: none !important;
    }

    /* Fix Solutions Section overlapping cards on mobile */
    .section-solutions {
        height: auto !important;
        overflow: visible !important;
    }
    .section-solutions > div {
        height: auto !important;
    }
    .section-solutions > div > .grid-6x6 {
        display: flex !important;
        flex-direction: column !important;
        height: auto !important;
        gap: 24px !important;
        padding-bottom: 40px !important;
    }
    .section-solutions > div > .grid-6x6 > div:first-child {
        align-self: flex-start !important;
    }
    .section-solutions .digifi-btn {
        font-size: 12px !important;
        padding: 4px 4px 4px 12px !important;
    }

    /* Fix Workflow Section (Our Process) mobile layout */
    .section-workflow > div > .grid-6x6 {
        display: flex !important;
        flex-direction: column !important;
        gap: 24px !important;
    }
    .section-workflow .grid-6x6 > div:first-child {
        position: relative !important;
        height: auto !important;
        top: auto !important;
    }
    .section-workflow .workflow-accordion {
        margin-top: 0 !important;
        padding-bottom: 40px !important;
    }
    .wf-acc-content p {
        max-width: 100% !important;
    }

    /* 4. Xử lý các khối nội dung tràn cột */
    [style*="span 6"], 
    [style*="span 5"], 
    [style*="span 4"],
    [style*="span 3"] {
        grid-column: 1 / -1 !important; /* Hầu hết các card, text sẽ chiếm 4 cột full */
    }

    /* Phân câu hỏi thì DIGIFI... */
    .section-faq > div > div > div:nth-child(2) {
        grid-column: 1 / -1 !important; 
        margin-bottom: 32px !important;
    }

    /* Ép nội dung từng câu hỏi FAQ trải dài full 4 cột, xóa khoảng trống của icon hover */
    .faq-content {
        grid-column: 1 / -1 !important;
    }
    .faq-tag {
        display: none !important;
    }

    /* 5. Căn chỉnh phần Danh sách dự án (Projects) tránh bị chồng chéo */
    .section-projects > div > div:first-child {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    .section-projects > div > div:first-child > div:nth-child(1) { grid-column: 1 !important; text-align: left !important; }
    .section-projects > div > div:first-child > div:nth-child(2) { grid-column: 2 !important; text-align: center !important; }
    .section-projects > div > div:first-child > div:nth-child(3) { grid-column: 3 !important; text-align: right !important; }

    .project-row {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    .project-row > div:nth-child(1) { grid-column: 1 !important; text-align: left !important; font-size: 14px !important; }
    .project-row > div:nth-child(2) { grid-column: 2 !important; text-align: center !important; font-size: 14px !important; }
    .project-row > div:nth-child(3) { grid-column: 3 !important; text-align: right !important; font-size: 14px !important; opacity: 1 !important; padding-top: 20px !important; }
    .project-row > div:nth-child(4) { grid-column: 1 / -1 !important; }

    /* 6. Footer chia 2 cột */
    #site-footer [style*="repeat(6, 1fr)"] {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px !important;
    }
    #site-footer [style*="repeat(6, 1fr)"] > div:nth-child(1) {
        grid-column: 1 / -1 !important; /* Branding full width */
    }
    #site-footer [style*="repeat(6, 1fr)"] > div:nth-child(2),
    #site-footer [style*="repeat(6, 1fr)"] > div:nth-child(3),
    #site-footer [style*="repeat(6, 1fr)"] > div:nth-child(4) {
        grid-column: span 1 !important; /* Các cột link chia đôi (2 cột) */
        margin-bottom: 20px !important;
    }
}
