/* 
* NeoReach APAC Landing Page Styles
*/

/* Global keyframes - must be outside scoped selectors to be accessible */
@keyframes scroll {
    to {
        transform: translate(calc(-50% - (var(--scroller-gap) / 2)));
    }
}

/* Scope all styles to the APAC template page only */
:where(body.page-template-apac) {

    --primary-color-override: #005699;

    /* Header Overrides */
    .cta-items.toplinks {
        display: none;
        visibility: hidden;
    }

    #globalMenu .menu-btn:before {
        background-color: var(--primary-color-override);
    }

    #globalMenu .menu-btn:after {
        background: unset;
    }

    /* Footer Overrides */
    #contact-form {
        .form-photo {
            display: none;
            visibility: hidden;
        }

        .outerContainer {
            background-color: white;
        }
    }

    main {
        --primary-color: var(--primary-color-override);
        --light-blue-bg: rgba(0, 86, 153, 0.08);
        --body-font: 'Outfit', sans-serif;
        --text-dark: #333333;
        --text-light: #ffffff;

        /* Base Styles */
        font-family: var(--body-font);
        font-optical-sizing: auto;
        font-style: normal;
        color: var(--text-dark);
        line-height: 1.6;

        & h1,
        & h2,
        & h3,
        & h4,
        & h5,
        & h6,
        & p,
        & li {
            text-wrap: balance;
        }

        & h1,
        & h2,
        & h3,
        & h4,
        & h5,
        & h6 {
            font-weight: 700;
        }

        & a:not(.btn) {
            color: var(--primary-color);
            text-decoration: none;
            transition: all 0.3s ease;
        }

        & a:not(.btn):hover {
            color: rgba(0, 86, 153, 0.8);
        }

        & .section-title {
            margin-bottom: 2rem;
            font-weight: 700;
            font-size: clamp(1.75rem, 4vw + 0.5rem, 2.5rem);
        }

        /* Hero Section */
        & .hero {
            padding: 10rem 0;
            position: relative;
            overflow-x: hidden;
        }

        @media (max-width: 768px) {
            & .hero {
                padding: 8rem 0 5rem 0;
            }
        }

        & .hero-title {
            font-size: clamp(2.25rem, 5vw + 1rem, 3rem);
            font-weight: 700;
        }

        & .hero-tagline {
            font-size: clamp(1.1rem, 2vw + 0.5rem, 1.4rem);
            line-height: 1.8;
        }

        & .hero-description {
            font-size: clamp(1rem, 1vw + 0.5rem, 1.125rem);
            line-height: 2;
        }

        & .hero-btn {
            padding: 20px;
            font-weight: 600;
            background-color: var(--primary-color);
            border: none;
            border-radius: 10px;
            letter-spacing: 1.5px;
            font-size: 1.1rem;
        }

        & .hero-btn:hover {
            background-color: rgba(0, 86, 153, 0.9);
        }

        & .hero-image-container {
            display: flex;
            justify-content: flex-start;
            align-items: center;
            height: 100%;
            position: relative;
            overflow: visible;
            -webkit-mask: linear-gradient(to right, white 90%, transparent 100%);
            mask: linear-gradient(to right, white 90%, transparent 100%);
        }

        & .hero-image {
            width: 1122px;
            max-width: none;
            height: auto;
            position: relative;
        }

        /* Scroller */
        & .scroller {
            max-width: 100%;
        }

        & .scroller {
            --scroller-gap: 8rem;
        }

        & .scroller__inner {
            padding-block: 1rem;
            padding: 0;
            display: flex;
            flex-wrap: wrap;
            gap: var(--scroller-gap);
            list-style: none;
        }

        @media (max-width: 768px) {
            & .scroller {
                --scroller-gap: 3rem;
            }
        }

        & .scroller[data-animated="true"] {
            overflow: hidden;
            -webkit-mask: linear-gradient(90deg, transparent, white 20%, white 80%, transparent);
            mask: linear-gradient(90deg, transparent, white 20%, white 80%, transparent);
        }

        & .scroller[data-animated="true"] .scroller__inner {
            width: max-content;
            flex-wrap: nowrap;
            animation: scroll 30s linear infinite;
        }

        /* Content Sections */
        & .apac-content-section {
            padding: 10rem 0;
        }

        @media (max-width: 768px) {
            & .apac-content-section {
                padding: 5rem 0;
            }
        }

        & .apac-content-section-blue {
            background-color: var(--light-blue-bg);
        }

        /* Feature list in Why NeoReach section */
        & .feature-list {
            list-style: none;
            padding: 2rem;
            margin: 0;
            position: relative;
            display: grid;
            grid-template-columns: 1fr;
            grid-gap: 1rem; /* Reduced gap for better spacing with dividers */
        }

        & .feature-item {
            display: grid;
            grid-template-columns: auto 1fr;
            grid-template-rows: auto auto;
            grid-template-areas: 
                "icon heading"
                "empty content";
            grid-gap: 0.5rem 1.5rem;
            position: relative;
            cursor: pointer;
            transition: background-color 0.25s ease, padding 0.25s ease;
            border-radius: 8px;
            padding: 1rem 1rem 1rem 1rem;
            margin-bottom: 1rem;
        }
        

        & .feature-item:hover {
            background-color: rgba(0, 86, 153, 0.05);
        }
        
        & .feature-item:focus {
            outline: 2px solid #005699;
            outline-offset: 2px;
            background-color: rgba(0, 86, 153, 0.05);
        }
        
        & .feature-item:focus-visible {
            outline: 2px solid #005699;
            outline-offset: 2px;
        }

        
        & .feature-item:not(:last-child)::after {
            content: '';
            position: absolute;
            bottom: -1rem; /* Position halfway between items */
            left: 0;
            width: 100%;
            height: 1px;
            background-color: #e5e5e5;
        }
        
        & .feature-item {
            background-color: rgba(0, 86, 153, 0.1);
        }

        & .feature-item.collapsed,
        & .feature-item.collapsing {
            background-color: transparent;
            padding-bottom: 0.75rem;
            padding-top: 0.75rem;
            transition: background-color 0.25s ease, padding 0.25s ease;
        }
        
        & .feature-item.collapsed .feature-content {
            margin-top: 0;
        }
        
        /* Remove the height: 0 that was preventing transitions */
        
        & .feature-item.collapsing .feature-content {
            margin-top: 0;
            /* Let Bootstrap handle the transition */
        }

        & .feature-icon {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background-color: rgba(0, 86, 153, 0.1);
            display: flex;
            justify-content: center;
            align-items: center;
            color: var(--primary-color);
            grid-area: icon;
            align-self: center;
        }

        & .feature-icon svg {
            width: 20px;
            height: 20px;
            stroke-width: 2px;
        }

        & .feature-item h3 {
            font-size: clamp(1.25rem, 2vw + 0.5rem, 1.5rem);
            margin-bottom: 0;
            font-weight: 600;
            color: var(--text-dark);
            grid-area: heading;
            align-self: center;
        }

        & .feature-content {
            grid-area: content;
            padding-left: 0;
            margin-top: 0.5rem;
        }

        & .feature-item p {
            font-size: clamp(1rem, 1vw + 0.5rem, 1.125rem);
            line-height: 1.8;
            margin-bottom: 0;
        }

        @media (max-width: 576px) {
            & .feature-list {
                grid-gap: 1rem;
                padding: 1.5rem;
            }

            & .feature-item {
                grid-gap: 1rem;
                padding: 1rem;
                grid-template-rows: auto auto;
                grid-template-areas: 
                    "icon heading"
                    "empty content";
            }
            
            & .feature-item:not(:last-child)::after {
                bottom: -1rem;
            }

            & .feature-item:first-child::before {
                top: -1.5rem;
                left: -1.5rem;
                right: -1.5rem;
                bottom: -.5rem;
            }

            & .feature-icon {
                width: 36px;
                height: 36px;
            }
            
            & .feature-item h3 {
                font-size: clamp(1.1rem, 1.5vw + 0.5rem, 1.3rem);
            }
            
            /* Center the section title when image is hidden on mobile */
            & .apac-content-section .section-title {
                text-align: center;
            }

        }

        /* Image container for Why NeoReach section */
        & .why-image-container {
            position: relative;
        }

        & .why-feature-img {
            max-width: 100%;
            max-height: 650px;
            height: auto;
            opacity: 0;
            transition: opacity 0.3s ease-in-out;
            border-radius: 8px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
        }

        & .why-feature-img.active {
            opacity: 1;
        }

        & .why-feature-img:not(.active) {
            position: absolute;
            top: 0;
            left: 0;
            width: 0;
            height: 0;
            overflow: hidden;
        }
        
        /* Respect user's motion preferences */
        @media (prefers-reduced-motion: reduce) {
            & .why-feature-img {
                transition: none;
            }
        }

        & .placeholder-text {
            color: #999;
            font-size: 1.2rem;
        }

        /* Cards for other sections */
        /* Section intro paragraphs - reusable for all sections */
        & .section-intro {
            font-size: clamp(1.1rem, 1vw + 0.8rem, 1.3rem);
            line-height: 1.8;
            margin-bottom: 0;
        }

        & .solution-card {
            height: 100%;
            padding: 2.5rem;
            border-radius: 12px;
            background-color: #fff;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
            text-align: center;
            display: flex;
            flex-direction: column;
            align-items: center;
        }

        & .solution-icon {
            margin-bottom: 1rem;
            width: 48px;
            height: 48px;
            display: flex;
            justify-content: center;
            align-items: center;
            color: var(--primary-color);
        }

        & .solution-card h3 {
            margin-bottom: 0.5rem;
            font-size: clamp(0.95rem, 1vw + 0.4rem, 1.1rem);
            font-weight: 600;
        }

        & .solution-card p {
            margin-bottom: 0;
            font-size: clamp(0.95rem, 1vw + 0.4rem, 1.1rem);
            line-height: 1.4;
            color: rgba(0, 0, 0, 0.7);
        }

        /* Case Studies Section */

        /* Case Studies Carousel - CSS-based with scroll snap */
        & .case-studies-container {
            position: relative;
            max-width: 1200px;
            margin: 0 auto;
            padding: 0 15px;
        }

        /* Navigation */
        & .carousel-indicators-container {
            display: flex;
            justify-content: center;
            margin-top: 5rem;
        }

        & .carousel-indicators {
            display: flex;
            gap: 0.75rem;
        }

        & .indicator-dot {
            width: 10px;
            height: 10px;
            border-radius: 50%;
            background-color: rgba(0, 86, 153, 0.3);
            cursor: pointer;
            transition: all 0.3s ease;
        }

        & .indicator-dot.active {
            background-color: var(--primary-color);
            transform: scale(1.2);
        }

        /* Case Studies Wrapper with Scroll Snap */
        & .case-studies-wrapper {
            width: 100%;
            overflow-x: auto;
            overflow-y: visible;
            position: relative;
            scroll-behavior: smooth;
            /* Enable smooth scrolling */
            scrollbar-width: none;
            /* Hide scrollbar in Firefox */
            -ms-overflow-style: none;
            /* Hide scrollbar in IE/Edge */
            touch-action: pan-x;
            -webkit-overflow-scrolling: touch;
            /* Create a scrolling context for calculations */
            scroll-snap-type: x mandatory;
        }

        & .case-studies-wrapper::-webkit-scrollbar {
            display: none;
            /* Hide scrollbar consistently */
        }

        & .case-studies-wrapper {
            /* Define these at wrapper level to be accessible to JS */
            --slide-gap: 2rem;
            /* Gap between slides */
            --slides-per-view: 2;
            /* Will be overridden in media query for mobile */
        }

        & .case-studies-track {
            display: flex;
            width: 100%;
            box-sizing: border-box;

            /* Create snap points for the whole page group */
            scroll-snap-type: x mandatory;
        }

        /* Create page containers for perfect snapping */
        & .case-study-slide {
            /* Calculate exact width for perfect alignment */
            --slide-width-calc: calc((100% - (var(--slides-per-view) - 1) * var(--slide-gap)) / var(--slides-per-view));

            flex: 0 0 var(--slide-width-calc);
            margin-right: var(--slide-gap);
            padding: 1rem;
            min-width: 0;
            box-sizing: border-box;

            /* Default snap alignment */
            scroll-snap-align: none;
        }

        /* Only the first slide of each "page" should be a snap point */
        & .case-study-slide:nth-child(odd) {
            scroll-snap-align: start;
        }

        /* On mobile, every slide is a snap point */
        @media (max-width: 992px) {
            & .case-study-slide {
                scroll-snap-align: start;
            }
        }

        /* Last slide shouldn't have margin to avoid extra space */
        & .case-study-slide:last-child {
            margin-right: 0;
        }

        /* Case Study Cards */
        & .case-study-card {
            height: 100%;
            display: flex;
            flex-direction: column;
            border-radius: 12px;
            background-color: #fff;
            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
            overflow: hidden;
        }

        /* For when real images are used instead of placeholders */
        & .case-study-image img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            border-radius: 8px;
        }

        & .case-study-image {
            height: 200px;
            padding: 1rem 1rem 0;
            overflow: hidden;
        }

        & .case-study-img-placeholder {
            display: flex;
            align-items: center;
            justify-content: center;
            height: 100%;
            color: #999;
            font-size: 1.2rem;
            background-color: #f5f5f5;
            border-radius: 8px;
        }

        & .case-study-content {
            padding: 1rem 2rem 2rem;
            flex: 1;
            display: flex;
            flex-direction: column;
            align-items: center;
            text-align: center;
        }

        & .case-study-brand {
            margin-bottom: 1rem;
            display: flex;
            justify-content: center;
        }

        & .case-study-logo {
            max-height: 60px;
            width: auto;
            max-width: 120px;
            object-fit: contain;
        }

        & .case-study-card h3.visually-hidden {
            position: absolute;
            width: 1px;
            height: 1px;
            padding: 0;
            margin: -1px;
            overflow: hidden;
            clip: rect(0, 0, 0, 0);
            white-space: nowrap;
            border: 0;
        }

        & .case-study-metrics-card {
            background-color: rgba(0, 86, 153, 0.03);
            border-radius: 8px;
            padding: 1.25rem 1.5rem;
            width: 100%;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
        }

        & .case-study-card p {
            font-size: clamp(0.95rem, 1vw + 0.4rem, 1.1rem);
            line-height: 1.5;
            color: rgba(0, 0, 0, 0.7);
            margin: 1.5rem 0;
            max-width: 90%;
        }

        & .case-study-link {
            display: inline-block;
            color: var(--primary-color);
            font-weight: 600;
            text-decoration: none;
            font-size: 1rem;
            padding: 0.5rem 0;
            transition: all 0.2s ease;
            margin-top: auto;
        }

        & .case-study-link:hover {
            color: var(--primary-color);
            transform: translateX(5px);
        }

        & .case-study-stats {
            display: flex;
            justify-content: space-between;
            width: 100%;
        }

        & .case-study-stats-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(4rem, 1fr));
            grid-template-rows: auto auto auto;
            gap: 1rem;
            justify-content: center;
        }

        & .stat-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            text-align: center;
        }

        & .stat-grid-item {
            display: grid;
            /* Use subgrid to align with parent grid rows */
            grid-template-rows: subgrid;
            grid-row: span 3;
            /* Span all 3 rows defined in parent */
            grid-template-areas:
                "icon"
                "value"
                "label";
            justify-items: center;
            row-gap: 0.5rem;
        }

        /* Fallback for browsers that don't support subgrid */
        @supports not (grid-template-rows: subgrid) {
            & .stat-grid-item {
                grid-template-rows: auto auto auto;
                align-items: start;
            }
        }

        & .stat-icon-wrapper {
            grid-area: icon;
            display: flex;
            justify-content: center;
            align-items: center;
            width: 3.5rem;
            height: 3.5rem;
            margin-bottom: 0.5rem;
        }

        & .stat-value {
            grid-area: value;
            font-size: clamp(1.25rem, 1.5vw + 0.5rem, 1.5rem);
            font-weight: 700;
            color: var(--primary-color);
            line-height: 1;
            margin: 0;
            text-align: center;
            width: 100%;
        }

        & .stat-label {
            grid-area: label;
            font-size: 0.8rem;
            color: rgba(0, 0, 0, 0.6);
            margin-top: 0.25rem;
            text-align: center;
            width: 100%;
            align-self: flex-start;
        }

        /* Mobile responsive styling for case studies */
        @media (max-width: 992px) {
            & .case-studies-wrapper {
                --slides-per-view: 1;
                /* Override to single column for mobile */
            }

            & .indicator-dot {
                width: 12px;
                height: 12px;
            }

            & .case-study-content {
                padding: 0.75rem;
            }

            & .case-study-metrics-card {
                padding: 1rem;
            }
        }

        @media (max-width: 576px) {
            & .case-study-image {
                padding: 0.75rem 0.75rem 0;
            }

            & .case-study-content {
                padding: 0.5rem;
            }

            & .case-study-metrics-card {
                padding: 0.75rem;
            }

            & .case-study-card p {
                margin: 1rem 0;
                max-width: 100%;
            }
        }

        /* Focus states for accessibility */
        & a:focus,
        & button:focus,
        & input:focus,
        & textarea:focus,
        & select:focus {
            outline: 2px solid var(--primary-color);
            outline-offset: 2px;
        }

        /* Skip to main content link - for keyboard navigation */
        & .skip-link {
            position: absolute;
            top: -40px;
            left: 0;
            background: var(--primary-color);
            color: white;
            padding: 8px;
            z-index: 1001;
            transition: top 0.3s;
        }

        & .skip-link:focus {
            top: 0;
        }

        /* SPECIFIC ELEMENT STYLES */
        /* Hero section styles */
        & .hero .container {
            position: relative;
        }

        & .hero .row>div:first-of-type {
            order: 2;
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            gap: 1.5rem;
        }

        & .hero .row>div:last-of-type {
            order: 1;
            margin-bottom: 1.5rem;
            overflow: visible;
            display: none;
        }

        @media (min-width: 992px) {
            & .hero .row>div:first-of-type {
                order: 1;
            }

            & .hero .row>div:last-of-type {
                order: 2;
                margin-bottom: 0;
                display: block;
            }
        }


        /* Solutions section styles */
        & .solutions-heading,
        & .case-studies-heading {
            text-align: center;
            margin-bottom: 1.5rem;
        }

        & .section-intro-container {
            text-align: center;
            margin-left: auto;
            margin-right: auto;
            margin-bottom: 3rem;
        }

        & .solution-item {
            margin-bottom: 1.5rem;
        }

        & .solutions-row {
            margin-bottom: 3rem;
        }

        /* Case studies section styles */
        & .case-studies-container {
            margin-bottom: 3rem;
        }

        /* Call to action buttons container */
        & .cta-container {
            text-align: center;
        }

    }
}
