/**
 * DECOFI Theme (NSSV3) — Lĩnh Vực Hoạt Động Trang Chủ (block_flexible_1)
 * Concept: Architectural Editorial Split Showcase & Asymmetric Collage
 * Synchronized with DECOFI Projects Design System (--c-primary / --c-secondary)
 */

.block_flexible_1 {
    position: relative;
}

/* ==========================================================================
   1. HEADER BAR: TIÊU ĐỀ RÃNH KIẾN TRÚC & ĐIỀU HƯỚNG NHANH
   ========================================================================== */
.block_flexible_1 .flexible-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.block_flexible_1 .flexible-section-title {
    flex: 1;
    margin-bottom: 0 !important;
}

.block_flexible_1 .flexible-header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.block_flexible_1 .flexible-live-counter {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    font-family: var(--font-main);
    line-height: 1;
    user-select: none;
}

.block_flexible_1 .flexible-live-counter .counter-current {
    font-size: 22px;
    font-weight: 700;
    color: var(--c-primary);
    letter-spacing: 0.5px;
}

.block_flexible_1 .flexible-live-counter .counter-divider,
.block_flexible_1 .flexible-live-counter .counter-total {
    font-size: 13px;
    font-weight: 600;
    color: var(--c-secondary);
    opacity: 0.75;
}

.block_flexible_1 .flexible-arrow-group {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.block_flexible_1 .flexible-nav-btn {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background-color: #ffffff;
    color: var(--c-secondary);
    border: 1.5px solid var(--c-secondary);
    clip-path: polygon(8px 0, 100% 0, 100% 100%, 0 100%, 0 8px);
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.block_flexible_1 .flexible-nav-btn::before {
    content: "";
    position: absolute;
    top: 7px;
    left: -2px;
    width: 15px;
    height: 1.5px;
    background-color: var(--c-secondary);
    transform-origin: 0 0;
    transform: rotate(-45deg);
    pointer-events: none;
    z-index: 2;
}

.block_flexible_1 .flexible-nav-btn:hover {
    background-color: var(--c-secondary);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(20, 83, 154, 0.22);
}

/* ==========================================================================
   2. KHUNG TRÌNH DIỄN CHÍNH: EDITORIAL SPLIT SHOWCASE (5:7)
   ========================================================================== */
.block_flexible_1 .flexible-showcase-stage {
    position: relative;
    display: grid;
    grid-template-columns: 1fr;
}

.block_flexible_1 .flexible-slide {
    grid-area: 1 / 1 / 2 / 2;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 1;
    transition: opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.55s ease;
}

.block_flexible_1 .flexible-slide.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    z-index: 5;
}

.block_flexible_1 .flexible-split-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
    align-items: stretch;
}

/* Mobile-First (< 1024px): Đưa Ảnh Collage lên trên (order: 1) và Thẻ Spec xuống dưới (order: 2) */
.block_flexible_1 .flexible-collage-col {
    order: 1;
}

.block_flexible_1 .flexible-spec-col {
    order: 2;
}

@media (min-width: 1024px) {
    .block_flexible_1 .flexible-showcase-stage {
        padding-bottom: 0;
    }

    .block_flexible_1 .flexible-split-grid {
        grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
        gap: 32px;
        align-items: flex-start;
    }

    .block_flexible_1 .flexible-spec-col {
        order: 1;
        grid-column: auto;
        display: block;
        position: relative;
        z-index: auto;
        margin-top: 38px;
    }

    .block_flexible_1 .flexible-collage-col {
        order: 2;
        grid-column: auto;
        display: block;
        position: relative;
        z-index: auto;
    }
}

/* ==========================================================================
   3. CỘT TRÁI: THẺ HỒ SƠ LĨNH VỰC VÁT GÓC DECOFI (.flexible-spec-card)
   ========================================================================== */
.block_flexible_1 .flexible-spec-card {
    position: relative;
    z-index: 5;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background-color: #ffffff;
    border: 2px solid var(--c-secondary);
    clip-path: polygon(20px 0, 100% 0, 100% 100%, 0 100%, 0 20px);
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.06);
    padding: 28px 28px 26px;
    transform: translateY(18px);
    transition: transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

.block_flexible_1 .flexible-slide.is-active .flexible-spec-card {
    transform: translateY(0);
}

.block_flexible_1 .flexible-spec-card::before {
    content: "";
    position: absolute;
    top: 18px;
    left: -2px;
    width: 30px;
    height: 2px;
    background-color: var(--c-secondary);
    transform-origin: 0 0;
    transform: rotate(-45deg);
    pointer-events: none;
    z-index: 3;
}

/* Thanh kỹ thuật đầu thẻ: Số thứ tự 01..08 bên phải & Nhãn Eyebrow đặt ngay trên flexible-spec-body */
.block_flexible_1 .flexible-spec-topbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding-bottom: 12px;
    margin-bottom: 14px;
    border-bottom: 1px dashed var(--c-border);
}

.block_flexible_1 .flexible-spec-num-wrap {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    font-family: var(--font-main);
    line-height: 1;
}

.block_flexible_1 .flexible-spec-num {
    font-size: 32px;
    font-weight: 700;
    color: var(--c-primary);
    letter-spacing: -0.5px;
}

.block_flexible_1 .flexible-spec-total {
    font-size: 13px;
    font-weight: 600;
    color: var(--c-secondary);
    opacity: 0.7;
}

.block_flexible_1 .flexible-spec-eyebrow {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    margin-bottom: 10px;
    padding: 5px 12px;
    background-color: rgba(206, 32, 39, 0.08);
    border-left: 3px solid var(--c-primary);
    color: var(--c-primary);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    line-height: 1.3;
}

/* Tiêu đề chính & Mô tả lĩnh vực */
.block_flexible_1 .flexible-spec-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.block_flexible_1 .flexible-spec-title {
    margin: 0 0 14px;
    font-family: var(--font-main);
    font-size: 23px;
    line-height: 1.32;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

@media (min-width: 1200px) {
    .block_flexible_1 .flexible-spec-title {
        font-size: 25px;
    }
}

.block_flexible_1 .flexible-spec-title a {
    color: var(--c-secondary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.block_flexible_1 .flexible-spec-title a:hover {
    color: var(--c-primary);
}

.block_flexible_1 .flexible-spec-rule {
    width: 52px;
    height: 3px;
    background-color: var(--c-primary);
    margin-bottom: 18px;
}

.block_flexible_1 .flexible-spec-note {
    font-size: 15px;
    line-height: 1.72;
    color: var(--c-text);
    opacity: 0.9;
    margin-bottom: 24px;
}

.block_flexible_1 .flexible-spec-footer {
    margin-top: auto;
    padding-top: 12px;
}

@media (max-width: 767px) {
    .block_flexible_1 .flexible-spec-card {
        padding: 18px 18px 18px;
        clip-path: polygon(16px 0, 100% 0, 100% 100%, 0 100%, 0 16px);
    }

    .block_flexible_1 .flexible-spec-card::before {
        top: 14px;
        width: 24px;
    }

    .block_flexible_1 .flexible-spec-topbar {
        padding-bottom: 8px;
        margin-bottom: 10px;
    }

    .block_flexible_1 .flexible-spec-num {
        font-size: 24px;
    }

    .block_flexible_1 .flexible-spec-title {
        font-size: 18px;
        margin-bottom: 10px;
    }

    .block_flexible_1 .flexible-spec-rule {
        margin-bottom: 12px;
    }

    .block_flexible_1 .flexible-spec-note {
        font-size: 13.75px;
        line-height: 1.62;
        margin-bottom: 14px;
        display: -webkit-box;
        -webkit-line-clamp: 4;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .block_flexible_1 .flexible-cta-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (min-width: 1024px) {
    .block_flexible_1 .flexible-spec-card {
        padding: 24px 22px 22px;
    }

    .block_flexible_1 .flexible-spec-title {
        font-size: 21px;
    }

    .block_flexible_1 .flexible-spec-note {
        font-size: 14.5px;
        line-height: 1.65;
        padding-right: 0;
        margin-bottom: 18px;
    }

    .block_flexible_1 .flexible-spec-footer {
        padding-right: 0;
    }
}

/* ==========================================================================
   4. CỘT PHẢI: HÌNH CHÍNH & HÌNH PHỤ GÓC DƯỚI BÊN TRÁI (CÁCH MÉP 12-14PX)
   ========================================================================== */
.block_flexible_1 .flexible-collage-stage {
    position: relative;
    width: 100%;
    min-height: auto;
    display: block;
    padding: 0;
}

/* Ảnh chính lớn (16:10): Đặt ở cao độ cao nhất (top: 0), mở rộng chiều rộng thêm ~14% trên Desktop */
.block_flexible_1 .flexible-img-primary {
    position: relative;
    z-index: 1;
    width: 100%;
    aspect-ratio: 16 / 10;
    margin: 0;
    overflow: hidden;
    background-color: var(--c-bg-alt);
    border: 1px solid var(--c-border);
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.12);
    transform: translateY(16px);
    transition: transform 0.65s cubic-bezier(0.22, 1, 0.36, 1) 0.04s;
}

@media (min-width: 1024px) {
    .block_flexible_1 .flexible-img-primary {
        width: 100%;
        margin-left: 0;
        height: auto;
    }
}

.block_flexible_1 .flexible-slide.is-active .flexible-img-primary {
    transform: translateY(0);
}

/* Ảnh phụ (4:3): Hình chữ nhật không viền/không vát, giảm thêm 10%, đặt ở góc dưới bên phải hình chính */
.block_flexible_1 .flexible-img-secondary {
    position: absolute;
    left: auto;
    right: 12px;
    bottom: 12px;
    width: 20%;
    max-width: 95px;
    aspect-ratio: 4 / 3;
    margin: 0;
    z-index: 15;
    background-color: transparent;
    padding: 0;
    border: 1.5px solid #ffffff;
    clip-path: none;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.32);
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.12s, opacity 0.6s ease 0.12s;
}

.block_flexible_1 .flexible-img-secondary::before {
    display: none;
}

@media (min-width: 768px) and (max-width: 1023px) {
    .block_flexible_1 .flexible-img-secondary {
        width: 17%;
        max-width: 120px;
        left: auto;
        right: 14px;
        bottom: 14px;
    }
}

@media (min-width: 1024px) {
    .block_flexible_1 .flexible-img-secondary {
        width: 130px;
        max-width: 130px;
        left: auto;
        right: 14px;
        bottom: 14px;
    }
}

.block_flexible_1 .flexible-slide.is-active .flexible-img-secondary {
    transform: translateY(0);
    opacity: 1;
}

.block_flexible_1 .flexible-img-link,
.block_flexible_1 .flexible-img-swap-btn {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    clip-path: none;
}

.block_flexible_1 .flexible-img-primary img,
.block_flexible_1 .flexible-img-secondary img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    display: block !important;
}

.block_flexible_1 .flexible-img-primary .flexible-layer-front,
.block_flexible_1 .flexible-img-secondary .flexible-layer-front {
    position: relative;
    z-index: 1;
    opacity: 1;
    transform: scale(1);
    will-change: transform;
    transition: transform 1.15s cubic-bezier(0.22, 1, 0.36, 1);
}

.block_flexible_1 .flexible-img-primary .flexible-layer-back,
.block_flexible_1 .flexible-img-secondary .flexible-layer-back {
    position: absolute;
    inset: 0;
    z-index: 2;
    opacity: 0;
    transform: scale(1.03);
    will-change: opacity, transform;
    pointer-events: none;
    transition: opacity 1.05s cubic-bezier(0.4, 0, 0.2, 1), transform 1.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.block_flexible_1 .flexible-slide.is-swapped .flexible-img-primary .flexible-layer-back,
.block_flexible_1 .flexible-slide.is-swapped .flexible-img-secondary .flexible-layer-back {
    opacity: 1;
    transform: scale(1);
}

.block_flexible_1 .flexible-slide.is-swapped .flexible-img-primary .flexible-layer-front,
.block_flexible_1 .flexible-slide.is-swapped .flexible-img-secondary .flexible-layer-front {
    transform: scale(1.02);
}

.block_flexible_1 .flexible-img-primary:hover .flexible-layer-front,
.block_flexible_1 .flexible-img-primary:hover .flexible-layer-back,
.block_flexible_1 .flexible-img-secondary:hover .flexible-layer-front,
.block_flexible_1 .flexible-img-secondary:hover .flexible-layer-back {
    transform: scale(1.05);
}

.block_flexible_1 .flexible-swap-badge {
    position: absolute;
    right: 4px;
    bottom: 4px;
    z-index: 5;
    width: 23px;
    height: 23px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(20, 83, 154, 0.88);
    color: #ffffff;
    font-size: 10.5px;
    clip-path: none;
    transition: background-color 0.25s ease, transform 0.25s ease;
    pointer-events: none;
}

.block_flexible_1 .flexible-img-secondary:hover .flexible-swap-badge {
    background-color: var(--c-primary);
    transform: scale(1.08);
}

/* Tag kỹ thuật ở góc trên bên phải ảnh chính */
.block_flexible_1 .flexible-img-tag {
    position: absolute;
    top: 14px;
    right: 14px;
    padding: 4px 11px;
    background-color: rgba(15, 23, 42, 0.76);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: #ffffff;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    border-left: 3px solid var(--c-primary);
    pointer-events: none;
}

/* ==========================================================================
   5. DẢI 8 TAB CHỈ MỤC LĨNH VỰC (4 CỘT x 2 HÀNG DESKTOP / VUỐT NGANG MOBILE)
   ========================================================================== */
.block_flexible_1 .flexible-index-grid {
    margin-top: 1.75rem;
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 6px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

@media (min-width: 640px) {
    .block_flexible_1 .flexible-index-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        overflow-x: visible;
        padding-bottom: 0;
    }
}

@media (min-width: 1024px) {
    .block_flexible_1 .flexible-index-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 14px;
    }
}

.block_flexible_1 .flexible-index-tab {
    position: relative;
    flex: 0 0 250px;
    scroll-snap-align: start;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 16px 15px;
    text-align: left;
    background-color: #ffffff;
    border: 1.5px solid var(--c-border);
    clip-path: polygon(11px 0, 100% 0, 100% 100%, 0 100%, 0 11px);
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
}

@media (min-width: 640px) {
    .block_flexible_1 .flexible-index-tab {
        flex: initial;
    }
}

.block_flexible_1 .flexible-index-tab:hover {
    border-color: var(--c-secondary);
    background-color: var(--c-bg-alt);
}

.block_flexible_1 .flexible-index-tab.is-active {
    background-color: var(--c-secondary);
    border-color: var(--c-secondary);
    box-shadow: 0 8px 20px rgba(20, 83, 154, 0.22);
}

.block_flexible_1 .flexible-tab-num {
    font-family: var(--font-main);
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    color: var(--c-primary);
    flex-shrink: 0;
    transition: color 0.3s ease;
}

.block_flexible_1 .flexible-index-tab.is-active .flexible-tab-num {
    color: #ffffff;
}

.block_flexible_1 .flexible-tab-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.block_flexible_1 .flexible-tab-eyebrow {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--c-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
    transition: color 0.3s ease;
}

.block_flexible_1 .flexible-index-tab.is-active .flexible-tab-eyebrow {
    color: rgba(255, 255, 255, 0.78);
}

.block_flexible_1 .flexible-tab-title {
    font-size: 13.5px;
    font-weight: 700;
    text-transform: uppercase;
    line-height: 1.3;
    color: var(--c-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.3s ease;
}

.block_flexible_1 .flexible-index-tab.is-active .flexible-tab-title {
    color: #ffffff;
}

/* Thanh tiến trình tự động chạy dưới đáy tab đang active */
.block_flexible_1 .flexible-tab-progress {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 0%;
    background-color: var(--c-primary);
    pointer-events: none;
}

.block_flexible_1 .flexible-index-tab.is-active .flexible-tab-progress {
    animation: flexibleTabProgress 6.4s linear forwards;
}

.block_flexible_1.is-paused .flexible-index-tab.is-active .flexible-tab-progress {
    animation-play-state: paused;
}

@keyframes flexibleTabProgress {
    0% {
        width: 0%;
    }
    100% {
        width: 100%;
    }
}

