.flagship-section {
    position: relative;
}

.image-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.image-card {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    isolation: isolate;
}

.image-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.image-card .image-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
            rgba(0, 0, 0, 0.15) 0%,
            rgba(0, 0, 0, 0.45) 100%);
    opacity: 1;
    transition: opacity 0.3s ease;
    z-index: 1;
}

/* Noise texture overlay via pseudo-element */
.image-card::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    /* background-image: url('data:image/svg+xml;utf8,\
  <svg xmlns="http://www.w3.org/2000/svg" width="120" height="120" viewBox="0 0 120 120">\
    <filter id="n"><feTurbulence type="fractalNoise" baseFrequency="0.8" numOctaves="2" stitchTiles="stitch"/></filter>\
    <rect width="100%" height="100%" filter="url(%23n)" opacity="0.04"/>\
  </svg>');
  mix-blend-mode: overlay; */
}

.image-card-title {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    padding: 0.75rem 1rem;
}

/* Hover polish: zoom image slightly and strengthen overlay */
.image-card:hover img {
    transform: scale(1.05);
}

.image-card:hover .image-overlay {
    opacity: 1;
    background: linear-gradient(180deg,
            rgba(0, 0, 0, 0.2) 0%,
            rgba(0, 0, 0, 0.55) 100%);
}

/* Tabs */

/* Glass-style tab bar */
.tab-buttons {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    background: rgba(7, 20, 35, 0.55);
    /* allow horizontal scrolling on narrow screens so pills don't wrap awkwardly */
    padding: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 999px;
    backdrop-filter: blur(8px) saturate(120%);
    -webkit-backdrop-filter: blur(8px) saturate(120%);
    border: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 6px 18px rgba(2,6,23,0.25) inset;
}

/* Individual tab pills */
.tab-button {
    padding: 0.5rem 1.25rem;
    border-radius: 20px;
    background: transparent;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    font-weight: 600;
    /* font-family: Poppins, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial; */
    font-size: 14px;
    line-height: 1;
    transition: all 220ms cubic-bezier(.2,.9,.2,1);
    box-shadow: none;
    outline: none;
    transform: translateZ(0); /* Force hardware acceleration */
    backface-visibility: hidden; /* Prevent flicker on transform */
    will-change: transform; /* Optimize for transform animations */
    margin-bottom: 2px; /* Add margin to prevent content from being cut off */

    /* prevent buttons from shrinking and allow horizontal scrolling container to work */
    flex: 0 0 auto;
    white-space: nowrap;
}

.tab-button.active {
    border-color: rgba(0, 0, 0, 0.25);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

.slide-group {
    display: none;
}

.slide-group.active {
    display: block;
}

/* Navigation buttons */
.nav-button {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    background: white;
    transition: transform 0.2s ease;
}

.nav-button:hover {
    transform: scale(1.06);
}

.flagship-section {
    position: relative;
    /* reduce default hero height so the header/logo and tabs align better vertically */
    min-height: 70vh;
    overflow: hidden;
    background: linear-gradient(180deg,
            rgba(0, 142, 67, 0.8) 0%,
            rgba(0, 40, 19, 0.8) 100%),
        url("../images/flagship-v2/thumb.jpg");
    background-size: cover;
    background-position: center;
}

.world-map-pattern {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.1;
}

.world-map-pattern svg {
    width: 100%;
    height: 100%;
}

.flagship-content {
    position: relative;
    
    z-index: 10;
    padding-block:  1rem; /* increase vertical spacing + 24px horizontal padding */
    box-sizing: border-box;
}

.flagship-header {
    display: flex;
    flex-direction: column;
    gap: 1.25rem; /* slightly more spacing between title and tabs */
    margin-bottom: 2rem; /* more breathing room below header */
    /* max-width: 1400px; */
    /* Let container decide alignment; on desktop we'll push this group to the right */
}

.header-text {
    max-width: 42rem;
}

.header-title {
    /* font-family: Poppins; */
    font-weight: 600;
    font-size: 20px;
    line-height: 100%;
    letter-spacing: 0%;
    color: white;
    margin-bottom: 0.5rem;
}

.header-subtitle {
    /* font-family: Poppins;/ */
    font-weight: 400;
    font-size: 13px;
    line-height: 100%;
    letter-spacing: 0%;
    text-align: justify;
    color: white;
}

.tab-buttons {
    display: flex;
    gap: 0.75rem;
    flex-shrink: 0;
    /* do not wrap - allow horizontal scroll on narrow screens */
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overflow-y: visible; /* Prevent vertical scrollbar from appearing */
    padding-bottom: 2px; /* Add small padding to account for transform */
    margin-bottom: -2px; /* Counteract the padding to prevent layout shift */
}

.tab-button.active {
    background: #ffffff;
    color: #0b1220;
    box-shadow: 0 4px 12px rgba(11,18,32,0.15);
    transform: translateY(-3px);
    margin-bottom: 0; /* Reset margin for active state */
}

.tab-button:not(.active):hover {
    transform: translateY(-1px);
    color: #ffffff;
    background: rgba(255,255,255,0.05);
}

.tab-button:focus {
    box-shadow: 0 0 0 4px rgba(59,130,246,0.12);
}

.tab-content {
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    width: 100%;
    overflow: hidden;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

.slide-group {
    display: none;
}

.slide-group.active {
    display: block;
}

.cards-container {
    display: flex;
    gap: 2rem;
    flex-direction: column;
    transition: transform 0.3s ease-out;
    will-change: transform;
    touch-action: pan-y;
}

.info-card {
    background: white;
    padding: 2.25rem; /* slightly larger interior padding for content breathing */
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    width: 100%;
    max-width: 455px;
    height: 334px;
    border-radius: 10px;
}

.decorative-circle-1 {
    position: absolute;
    right: -3rem;
    top: -3rem;
    width: 12rem;
    height: 12rem;
    border: 2px solid #f3f4f6;
    border-radius: 50%;
}

.decorative-circle-2 {
    position: absolute;
    right: -5rem;
    bottom: -5rem;
    width: 16rem;
    height: 16rem;
    border: 2px solid #f3f4f6;
    border-radius: 50%;
}

.info-card-content {
    position: relative;
    z-index: 10;
    padding: 0.625rem 0;
}

.card-label {
    /* font-family: Poppins; */
    font-weight: 500;
    font-size: 14px;
    line-height: 100%;
    letter-spacing: 0%;
    text-align: left;
    color: #6b7280;
    margin-bottom: 1rem;
    text-transform: uppercase;
}

.card-title {
    /* font-family: Poppins; */
    font-weight: 600;
    font-size: 18px;
    line-height: 120%;
    letter-spacing: 0%;
    text-align: left;
    color: #111827;
    margin-bottom: 1.5rem;
}

.card-description {
    /* font-family: Poppins; */
    font-weight: 400;
    font-size: 14px;
    line-height: 140%;
    letter-spacing: 0%;
    text-align: justify;
    color: #6b7280;
    margin-bottom: 2rem;
}

.card-button {
    background: #008e43;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    /* font-family: Poppins; */
    font-weight: 500;
    font-size: 12px;
    line-height: 100%;
    letter-spacing: 0%;
    border: none;
    cursor: pointer;
    transition: background 0.3s ease;
}

.card-button:hover {
    background: #006d33;
}

.image-cards {
    display: flex;
    gap: 1rem;
    flex: 1;
    flex-direction: column;
}

.image-card {
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    flex: 1;
    border-radius: 10px;
    min-width: 0;
    height: 334px;
}

.image-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top,
            rgba(0, 0, 0, 0.8),
            rgba(0, 0, 0, 0.3) 50%,
            transparent);
}

.image-card-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.5rem;
}

.image-card-title h3 {
    /* font-family: Poppins; */
    font-weight: 600;
    font-size: 1.1rem;
    line-height: 120%;
    text-align: center;
    color: white;
    margin: 0;
}

.navigation-arrows {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 2rem;
}

.nav-button {
    background: white;
    color: #111827;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: background 0.3s ease;
}

.nav-button:hover {
    background: #f3f4f6;
}

.nav-button svg {
    width: 24px;
    height: 24px;
}

/* /* stronger seam hide for flagship section */
.flagship-section,
.flagship-section * {
    background-repeat: no-repeat !important;
    /* background-image: none !important; */
    border: none !important;
    /* box-shadow: none !important; */
}

/* hide hr and similar separators in and immediately after the flagship section */
.flagship-section hr,
.flagship-section+* hr,
.flagship-section::before,
.flagship-section::after,
.flagship-section+*::before,
.flagship-section+*::after {
    display: none !important;
    height: 0 !important;
    border: 0 !important;
    background: transparent !important;
}

/* avoid subpixel seam by forcing layer and block display */
.flagship-section img,
.flagship-section>* {
    display: block !important;
    transform: translateZ(0) !important;
    -webkit-font-smoothing: antialiased !important;
    backface-visibility: hidden !important;
}



/* Tablet layout (approx 640–1023px): make flagship section a bit more compact */
@media (min-width: 640px) and (max-width: 1023.98px) {
    /* .flagship-content {
        width: 90%;
    } */

    .header-title {
        font-size: 18px;
    }

    .header-subtitle {
        font-size: 12px;
    }

    .cards-container {
        gap: 1.25rem;
    }

    .info-card {
        padding: 1.5rem;
        height: 300px;
    }

    .image-card {
        height: 300px;
    }
}

/* Tablet+ image layout */
@media (min-width: 640px) {
    .image-cards {
        flex-direction: row;
    }
}

/* Mobile-specific tweaks for tab buttons and pills */
@media (max-width: 640px) {
    .tab-buttons {
        gap: 0.5rem;
        padding: 6px 0.5rem;
    }

    .tab-button {
        padding: 8px 12px; /* tighter horizontal padding for small screens */
        font-size: 13px;
    }

}

/* Desktop */
@media (min-width: 1024px) {
    .flagship-content {
       padding-block: 3rem;
    }

    .flagship-header {
        flex-direction: row;
        /* vertically center title and tab buttons so they align with header/logo */
        align-items: center;
        justify-content: space-between;
    }

    .cards-container {
        flex-direction: row;
        align-items: stretch;
    }

    /* On larger screens align the tab buttons to the right edge */
    .tab-buttons {
        margin-left: auto;
        margin-right: 0;
        justify-content: flex-end;
    }

    /* Reduce various container max-widths to align with new site grid */
    .flagship-header {
        max-width: 1330px;
        margin-left: auto;
        margin-right: auto;
    }

    .tab-content {
        max-width: 1330px;
        margin-left: auto;
        margin-right: auto;
    }
}