/* =========================================
   HOME PAGE STYLES
   ========================================= */

/* Reveal animation - enhanced for JS-disabled fallback */
section {
    opacity: 1;
    /* No transform here: a transform on a section makes it the containing block for
       position:fixed children, which pinned the hero popover to the hero's top-left corner. */
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.js-enabled section.js-hidden {
    opacity: 0;
    transform: translateY(20px);
}

.js-enabled section.js-hidden.visible {
    opacity: 1;
    transform: none;
}

.main > section:nth-child(2) { transition-delay: 0.1s; }
.main > section:nth-child(3) { transition-delay: 0.2s; }
.main > section:nth-child(4) { transition-delay: 0.3s; }
.main > section:nth-child(5) { transition-delay: 0.4s; }
.main > section:nth-child(6) { transition-delay: 0.5s; }
.main > section:nth-child(7) { transition-delay: 0.6s; }
.main > section:nth-child(8) { transition-delay: 0.7s; }
.main > section:nth-child(9) { transition-delay: 0.8s; }
.main > section:nth-child(10) { transition-delay: 0.9s; }

/* Shared section styles */
.section-title {
    text-align: center;
    margin-bottom: 2.5rem;
    font-size: clamp(1.8rem, 3.5vw, 2.6rem);
    color: var(--td-black);
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -10px;
    width: 60px;
    height: 4px;
    background-color: var(--td-purple-line);
    transform: translateX(-50%);
}

/* Trust strip */
.trust-strip {
    background-color: var(--td-ice);
    padding: 1.5rem 0;
    text-align: center;
}

.trust-strip-text {
    font-size: 1.125rem;
    color: var(--td-grey);
    max-width: 800px;
    margin: 0 auto;
    font-style: italic;
}

/* Hero section */
.hero {
    background: var(--grad-hero);
    color: var(--td-white);
    position: relative;
    overflow: hidden;
    padding: clamp(56px, 8vw, 96px) 0;
}

.hero::before,
.hero::after {
    content: "";
    position: absolute;
    pointer-events: none;
}

.hero::before {
    top: 0;
    right: 0;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle at top right, var(--td-teal) 0%, transparent 40%);
}

.hero::after {
    bottom: 0;
    right: 0;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle at bottom right, #e6e6fa 0%, transparent 40%);
}

.hero .container {
    position: relative;
    z-index: 2;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: clamp(32px, 5vw, 72px);
    align-items: center;
}

.hero-content {
    text-align: left;
}

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0;
    padding: 0;
    color: var(--td-yellow);
    text-transform: uppercase;
    letter-spacing: .08em;
    font-size: .8rem;
    font-weight: 700;
    font-family: Arial, Helvetica, sans-serif;
}

.hero-title {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 700;
    color: var(--td-white);
    font-size: clamp(2.3rem, 5vw, 3.8rem);
    line-height: 1.1;
    margin-bottom: 1.25rem;
}

.hero-title .accent {
    color: var(--td-yellow);
}

.hero-text {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 400;
    color: rgba(255,255,255,0.9);
    font-size: 1.1rem;
    line-height: 1.7;
    max-width: 540px;
    margin-bottom: 1.75rem;
}

/* Hero button - single button layout */
.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    align-items: center;
    justify-content: flex-start;
    margin-top: 2rem;
    margin-bottom: 0;
}

.hero-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 28px;
    min-height: 48px;
    height: auto;
    font-weight: 700;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.2s ease;
    box-sizing: border-box;
    flex: 0 0 auto;
    margin: 0;
    white-space: nowrap;
}

.hero-actions .btn-primary {
    background: var(--td-yellow);
    color: var(--td-black);
}

.hero-actions .btn-primary:hover {
    background: var(--td-yellow-dark);
    transform: translateY(-2px);
}

.hero-actions .btn-outline {
    background: transparent;
    color: var(--td-white);
    border: 2px solid var(--td-white);
}

.hero-actions .btn-outline:hover {
    background: var(--td-white);
    color: var(--td-navy);
}

/* Hero features - 3 column grid */
.hero-features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px 28px;
    margin-top: 1.5rem;
    margin-bottom: 0;
    list-style: none;
    padding: 0;
}

.hero-features li {
    list-style: none;
}

/* Interactive Service Triggers */
.service-trigger {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    color: var(--td-white);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
    font-family: inherit;
    text-align: left;
    width: 100%;
    box-sizing: border-box;
}

.service-trigger:hover,
.service-trigger:focus-visible {
    background-color: rgba(255, 255, 255, 0.1);
}

.service-trigger:focus-visible {
    outline: 2px solid var(--td-yellow);
    outline-offset: 2px;
}

.service-trigger .icon {
    width: 20px;
    height: 20px;
    flex: none;
    color: var(--td-yellow, #FFC000);
    display: block;
}

/* Service Popover Styles - FIXED: Hidden by default using display: none */
.service-popover {
    position: fixed;
    top: 0;
    left: 0;
    width: 340px;
    max-width: calc(100vw - 32px);
    background: var(--td-navy, #14438A);
    color: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 192, 0, 0.3);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    display: none; /* CRITICAL FIX: Ensures the popover is completely hidden on page load */
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
}

.service-popover.is-visible {
    opacity: 1;
    visibility: visible;
    display: block; /* CRITICAL FIX: Allows the popover to render when activated by JS */
    pointer-events: auto;
}

.popover-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.popover-icon-wrapper {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 192, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.popover-icon {
    width: 20px;
    height: 20px;
    stroke: var(--td-yellow, #FFC000);
}

.popover-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--td-yellow, #FFC000);
    margin: 0;
    line-height: 1.3;
}

.popover-desc {
    font-size: 0.9rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.9);
    margin: 0 0 16px 0;
}

.popover-caps {
    list-style: none;
    padding: 0;
    margin: 0 0 16px 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.popover-caps li {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.85);
    position: relative;
    padding-left: 12px;
}

.popover-caps li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    width: 4px;
    height: 4px;
    background-color: var(--td-yellow, #FFC000);
    border-radius: 50%;
}

.popover-accent-line {
    height: 2px;
    width: 40px;
    background-color: var(--td-yellow, #FFC000);
    border-radius: 2px;
}

.hero-visual {
    max-width: 560px;
}

.hero-frame {
    position: relative;
    padding: 16px;
    border: 2px solid rgba(255,192,0,0.55);
    border-radius: 24px;
    background: rgba(255,255,255,0.08);
    backdrop-filter: blur(4px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}

.hero-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: clamp(300px, 34vw, 400px);
    padding: 32px;
    position: relative;
    border-radius: 18px;
    overflow: hidden;
    background: #0B2A5B;
}

.hero-chip {
    position: absolute;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--td-white);
    color: var(--td-navy);
    font-weight: 700;
    font-size: .875rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    z-index: 10;
}

.hero-chip.chip-top {
    top: 6px;
    right: 6px;
}

.hero-chip.chip-bottom {
    bottom: 6px;
    left: 6px;
}

/* Hero Logos - heading + grid of separate logo cards */
.hero-logos {
    position: relative;
    z-index: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero-logos-title {
    margin: 0 0 20px;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.8);
}

/* Tech grid - 3 columns */
.hero-tech-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    width: 100%;
}

/* Center the last card if it's the only one in the last row (e.g., 7 items in a 3-col grid) */
.hero-tech-card:last-child:nth-child(3n + 1) {
    grid-column: 2;
}

.hero-tech-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 96px;
    padding: 12px 8px;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-sizing: border-box;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    gap: 6px;
}

.hero-tech-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.hero-tech-card img {
    display: block;
    width: auto;
    max-width: 80px;
    height: 32px;
    object-fit: contain;
}

.tech-name {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--td-navy, #14438A);
    text-align: center;
    line-height: 1.2;
    margin: 0;
}

/* Differentiators */
.differentiators {
    background-color: var(--td-white);
    padding: 4rem 0;
}

.differentiators-content {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
    max-width: 1000px;
    margin: 0 auto;
}

.differentiator {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 4px 16px rgba(11, 42, 91, .08);
    padding: 40px 32px;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.differentiator:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 24px rgba(11, 42, 91, .12);
}

.differentiator .icon-circle {
    background-color: var(--td-yellow, #FFC000);
    color: var(--td-black, #1A1A1A);
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 24px;
}

.differentiator h3 {
    color: var(--td-navy);
    margin-bottom: 1rem;
    font-size: 1.25rem;
    font-weight: 700;
}

.differentiator p {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--td-grey);
}

/* Offerings */
.offerings {
    background-color: var(--td-white);
    padding: 4rem 0;
}

.offerings-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px 24px;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

.offerings-head .section-title {
    text-align: left;
    margin: 0;
}

.offerings-head .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    min-height: 48px;
    height: auto;
    width: auto;
    white-space: nowrap;
    flex: none;
}

.offerings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.offering-card {
    background-color: var(--td-white);
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    padding: 2rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-top: 4px solid transparent;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    height: 100%;
}

.offering-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
    border-top-color: var(--td-purple-line);
}

.offering-card:nth-child(3n+1) {
    border-top-color: var(--td-yellow);
}

.offering-card:nth-child(3n+2) {
    border-top-color: var(--td-blue);
}

.offering-card:nth-child(3n+3) {
    border-top-color: var(--td-teal);
}

.offering-icon {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    flex: none;
    border-radius: 50%;
    background: var(--td-navy, #14438A);
    color: var(--td-yellow, #FFC000);
}

.offering-icon svg {
    width: 28px;
    height: 28px;
    display: block;
}

.offering-title {
    color: var(--td-black);
    margin-bottom: 1rem;
    font-size: 1.25rem;
    font-weight: 700;
}

.offering-description {
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--td-grey);
}

/* Industries - 5 column grid */
.industries {
    background-color: var(--td-white);
    padding: 4rem 0;
}

.industries-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 24px;
    margin-top: 2rem;
}

.industry-card {
    background: linear-gradient(160deg, var(--td-navy, #14438A) 0%, var(--td-navy-deep, #0B2A5B) 100%);
    border-radius: 12px;
    border-top: 3px solid var(--td-yellow, #FFC000);
    padding: 32px 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.industry-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(11, 42, 91, 0.3);
}

.industry-card .cd-icon {
    width: 64px;
    height: 64px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
}

.industry-card .cd-icon svg {
    width: 30px;
    height: 30px;
    stroke: #fff;
    fill: none;
}

.industry-card .cd-title {
    color: var(--td-yellow, #FFC000);
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.35;
    margin: 0;
}

/* Engagement - 4 column grid */
.engagement {
    background-color: var(--td-ice);
    padding: 4rem 0;
}

.engagement-models {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-top: 2rem;
}

.model {
    background: linear-gradient(160deg, var(--td-navy, #14438A) 0%, var(--td-navy-deep, #0B2A5B) 100%);
    border-radius: 12px;
    border-top: 3px solid var(--td-yellow, #FFC000);
    padding: 32px 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.model:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(11, 42, 91, 0.3);
}

.model .cd-icon {
    width: 64px;
    height: 64px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
}

.model .cd-icon svg {
    width: 30px;
    height: 30px;
    stroke: #fff;
    fill: none;
}

.model h3 {
    color: var(--td-yellow, #FFC000);
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
}

.model p {
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.95rem;
    line-height: 1.7;
    margin: 0;
}

/* Final CTA */
.final-cta {
    background: var(--grad-hero);
    color: var(--td-white);
    text-align: center;
    padding: 4rem 0;
    position: relative;
    overflow: hidden;
}

.final-cta .container {
    position: relative;
    z-index: 2;
}

.final-cta .section-title {
    color: var(--td-white);
    margin-bottom: 2rem;
    font-size: clamp(2rem, 4vw, 2.8rem);
    font-weight: 700;
}

.final-cta .section-title::after {
    background-color: var(--td-white);
}

/* Who We Are */
.hw-who {
    background-color: var(--td-white);
    padding: 4rem 0;
}

.hw-who-content {
    max-width: 760px;
    margin: 0 auto;
    text-align: center;
}

.hw-who-content h2 {
    font-size: clamp(1.9rem, 3.5vw, 2.6rem);
    margin-bottom: 1.5rem;
    color: var(--td-black);
    text-align: center;
}

.hw-who-content p {
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--td-black);
    margin-bottom: 2rem;
}

/* Purpose */
.hw-purpose {
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, var(--td-navy, #14438A) 0%, var(--td-navy-deep, #0B2A5B) 100%);
    color: #fff;
    text-align: center;
    padding: 4rem 0;
}

.hw-purpose-inner {
    position: relative;
    z-index: 1;
    max-width: 780px;
    margin: 0 auto;
}

.hw-purpose h2 {
    color: #fff;
    font-size: clamp(1.9rem, 3.5vw, 2.6rem);
    margin-bottom: 1.5rem;
    text-align: center;
}

.hw-purpose p {
    margin: 0 auto;
    max-width: 720px;
    font-size: 1.2rem;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.92);
    text-align: center;
}

/* =========================================
   RESPONSIVE DESIGN
   ========================================= */

/* Tablet */
@media (max-width: 992px) {
    .hero-grid {
        grid-template-columns: 1fr;
        gap: clamp(24px, 4vw, 48px);
    }
    
    .hero-visual {
        max-width: 100%;
    }
    
    .hero-content {
        max-width: 560px;
        margin: 0 auto;
    }
    
    .hero-features {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px 20px;
    }
    
    .industries-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .engagement-models {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .differentiators-content {
        grid-template-columns: 1fr;
        max-width: 500px;
    }

    .hero-chip.chip-top,
    .hero-chip.chip-bottom {
        display: none;
    }
    
    .hero-tech-card {
        min-height: 90px;
        padding: 10px 6px;
    }
    
    .hero-tech-card img {
        max-width: 70px;
        height: 28px;
    }
    
    .tech-name {
        font-size: 0.75rem;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .hero-title {
        font-size: clamp(2.1rem, 5vw, 3.2rem);
    }
    
    .hero-actions {
        justify-content: center;
        gap: 16px;
    }
    
    .hero-actions .btn {
        flex: 1 1 calc(50% - 8px);
        max-width: calc(50% - 8px);
        min-height: 48px;
    }
    
    .offerings-head {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .offerings-head .section-title {
        text-align: center;
        margin-bottom: 16px;
    }
    
    .offerings-head .btn {
        margin-top: 8px;
    }
    
    .industries-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Mobile popover becomes a static block below the triggers */
    .service-popover {
        position: static !important;
        transform: none !important;
        width: 100%;
        max-width: 100%;
        margin: 16px 0 0 0;
        opacity: 1;
        visibility: visible;
        display: none; /* Ensures it stays hidden on mobile until activated */
        pointer-events: auto;
        z-index: auto;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        /* Overflow fix (mobile only): padding and border count inside the 100% width */
        box-sizing: border-box;
        min-width: 0;
        overflow-wrap: anywhere;
    }

    /* Let the hero columns and the card's inner text shrink instead of pushing the page wider */
    .hero-grid > * { min-width: 0; }
    .popover-title,
    .popover-desc,
    .popover-caps li { min-width: 0; overflow-wrap: anywhere; }
    
    .service-popover.is-visible {
        display: block;
    }
}

/* Small mobile */
@media (max-width: 576px) {
    .hero-features {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px 16px;
    }
    
    .industries-grid {
        grid-template-columns: 1fr;
    }
    
    .engagement-models {
        grid-template-columns: 1fr;
    }
    
    .hero-tech-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }
    
    /* Adjust centering rule for 2-column grid on small mobile */
    .hero-tech-card:last-child:nth-child(2n + 1) {
        grid-column: 2;
    }
    
    .hero-tech-card {
        min-height: 80px;
        padding: 10px;
    }
    
    .hero-tech-card img {
        max-width: 60px;
        height: 24px;
    }
}

/* Very small mobile */
@media (max-width: 480px) {
    .hero-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .hero-actions .btn {
        flex: 1 1 100%;
        max-width: 100%;
        width: 100%;
    }
    
    .hero-card {
        padding: 24px 16px;
    }
    
    .hero-tech-grid {
        gap: 8px;
    }
    
    .hero-tech-card {
        min-height: 70px;
        padding: 8px;
    }
    
    .hero-tech-card img {
        max-width: 50px;
        height: 20px;
    }
    
    .tech-name {
        font-size: 0.7rem;
    }
}

@media (max-width: 393px) {
    .hero-features {
        gap: 10px 12px;
    }
    
    .hero-logos-title {
        font-size: 0.7rem;
        margin-bottom: 14px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .hero-tech-card:hover {
        transform: none;
    }
}