:root {
    /* Color Palette */
    --color-navy: #0F172A;
    --color-slate: #334155;
    --color-light-slate: #94A3B8;
    --color-white: #FFFFFF;
    --color-off-white: #F8FAFC;
    --color-gold: #C5A059;
    --color-gold-dim: #A38446;

    /* Dark Mode Defaults - High Contrast */
    --color-bg: var(--color-off-white);
    --color-text: var(--color-slate);
    --bg-card: #ffffff;
    --bg-header: #ffffff;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --border-color: #e2e8f0;

    /* Spacing */
    --spacing-sm: 1.5rem;
    --spacing-md: 3rem;
    --spacing-lg: 6rem;
    --spacing-xl: 10rem;

    /* Layout */
    --container-width: 1400px;
    /* Increased for wider header */
}

body.dark-mode {
    --color-navy: #ffffff;
    /* This is primarily for TEXT usually, problematic if used for BG */
    --color-slate: #d1d5db;
    --color-light-slate: #9ca3af;
    --color-bg: #0f172a;
    --color-text: #f1f5f9;
    --bg-card: #1e293b;
    --bg-header: #1e293b;
    --shadow-color: rgba(0, 0, 0, 0.5);
    --border-color: #334155;

    background-color: var(--color-bg);
    color: var(--color-text);
}

body {
    font-family: var(--font-sans);
    color: var(--color-text);
    background-color: var(--color-bg);
    line-height: 1.8;
    font-size: 1.3rem;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s, color 0.3s;

}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    overflow-x: clip;
    /* Prevent horizontal scroll "zoomed in" effect? hidden - changed to clip!! */
    width: 100%;
}

/* Accessibility Focus States */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--color-gold);
    outline-offset: 2px;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-serif);
    color: var(--color-navy);
    line-height: 1.2;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}

a h3 {
    margin-bottom: 2vh;
}

ul {
    list-style: none;
}

/* Utilities */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 var(--spacing-sm);
}

.section {
    padding: var(--spacing-md) 0;
}

.bg-navy {
    background-color: var(--color-navy);
    color: white;
}

.bg-white {
    background-color: var(--bg-card);
    /* Adaptive white/dark-card */
}

.text-gold {
    color: var(--color-gold);
}

.btn {
    display: inline-block;
    padding: 8px 8px;
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: var(--color-gold);
    color: var(--color-navy);
}

.btn-primary:hover {
    background-color: var(--color-gold-dim);
}

.btn-outline {
    border-color: var(--color-white);
    color: var(--color-white);
}

.btn-outline:hover {
    background-color: var(--color-white);
    color: var(--color-navy);
}

/* Header */
.main-header {
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--shadow-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background-color 0.3s, border-color 0.3s;
    box-shadow: 0 4px 20px var(--shadow-color);

}

/* Subscribe Button */
.newsletter-form button {
    background-color: var(--color-gold);
    color: var(--color-navy);
    border: none;
    font-weight: 600;
}

.newsletter-form button:hover {
    background-color: var(--color-gold-dim);
    color: white;
}

/* Newsletter Styles (Footer) */
.newsletter-form {
    margin-top: 1.5rem;
}

.newsletter-input {
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    /* Increased border contrast */
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    width: 100%;
    margin-bottom: 0.5rem;
}

.newsletter-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.newsletter-input:focus {
    outline: none;
    border-color: var(--color-gold);
    background: rgba(255, 255, 255, 0.1);
}

/* Dark Mode specific overrides for elements with inline styles or default white backgrounds */
body.dark-mode .service-card,
body.dark-mode .service-info-box,
body.dark-mode .team-card,
body.dark-mode .news-item,
body.dark-mode .bg-white,
body.dark-mode [style*="background-color: white"],
body.dark-mode [style*="background: white"] {
    background-color: var(--bg-card) !important;
    /* Force overrides of inline styles */
    border-color: var(--border-color);
    color: var(--color-text);
}

/* Fix text color in dark mode for specific areas */
body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode .title {
    color: var(--color-text);
}

/* Dark Mode Hero & Navy Section Fixes */
body.dark-mode .hero,
body.dark-mode .bg-navy {
    background-color: #020617 !important;
    /* Forces dark background */
    color: #f8fafc !important;
    /* Forces white text */
}

body.dark-mode .hero h1,
body.dark-mode .hero p,
body.dark-mode .bg-navy h1,
body.dark-mode .bg-navy h2,
body.dark-mode .bg-navy p,
body.dark-mode .bg-navy li {
    color: #f8fafc !important;
}

/* Why Us Grid (Home Page) */
.why-us-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

/* Hero Buttons */
.hero-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Team Card (About Page) */
/* Team Card (About Page) */
.team-card {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 2rem;
    align-items: start;
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.team-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 0;
    object-fit: cover;
    object-position: top;
    border: 1px solid var(--border-color);
    /* Added border to clarify square shape if needed, user mentioned borders */
}

body.dark-mode .team-card {
    background-color: var(--bg-card);
}

body.dark-mode .text-gold {
    color: var(--color-gold);
}

/* Dark Mode Footer Fix */
body.dark-mode footer {
    background-color: #020617 !important;
    /* Very dark background */
    border-top-color: #1e293b;
}

/* Light Mode About Page Contrast */
/* We target the specific white sections in about page if simpler methods fail, 
   but easier to just use a slightly off-white for main backgrounds in light mode 
   or ensure cards have shadows.
   Let's make the "About" content section slightly darker in light mode.
*/
.bg-light-contrast {
    background-color: #f1f5f9;
    /* Slate-100 */
}

/* Scroll to top button */
.scroll-top-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background-color: var(--color-gold);
    color: white;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 999;
}

.scroll-top-btn.visible {
    opacity: 1;
    pointer-events: auto;
}

.scroll-top-btn:hover {
    transform: translateY(-3px);
    background-color: var(--color-gold-dim);
}

/* Dark mode toggle button */
/* Dark mode toggle button */
.theme-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    font-size: 1.3rem;
    padding: 0.5rem 1rem;
    transition: all 0.3s;
    color: #e2e8f0;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 80px;
}

.logo {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-navy);
    letter-spacing: -0.5px;
}

/* Navigation Links */
.nav-links {
    display: flex;
    gap: 1.5rem;
    margin-right: 1.5rem;
    /* Space between nav and actions */
}

.nav-links a {
    font-weight: 500;
    font-size: 1.3rem;
    color: var(--color-slate);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--color-gold);
}

/* Header Actions (Contact) */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Footer */
footer {
    background-color: var(--color-navy);
    color: #e2e8f0;
    /* Lighter text for better contrast against Navy background in Light Mode */
    padding: var(--spacing-sm) 0;
    font-size: 1.3rem;
    border-top: 1px solid var(--border-color);
}

.footer-links a {
    color: #cbd5e1;
    /* Lighter slate for links */
}

/* Service Tabs Dark Mode Fix */
body.dark-mode .service-btn {
    background-color: #334155;
    color: var(--color-text);
    border-left: 4px solid transparent;
}

body.dark-mode .service-btn:hover {
    background-color: #475569;
}

body.dark-mode .service-btn.active {
    background-color: var(--color-gold);
    color: var(--color-navy);
    /* Dark text on gold */
}

/* Logo Contrast in Dark Mode */
body.dark-mode .logo img {
    filter: brightness(0) invert(1);
    opacity: 0.9;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 4rem;
}

.footer-col h4 {
    color: var(--color-white);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    position: relative;
}

.footer-links li {
    margin-bottom: 0.8rem;
}

.footer-links a:hover {
    color: var(--color-gold);
}

/* Footer Bottom Section */
.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-wrap: wrap;
    /* allow wrapping on small screens */
}

.legal-links {
    display: flex;
    gap: 1rem;
    align-items: center;
    font-size: 1.3rem;
}

.legal-links a {
    color: var(--color-light-slate);
    transition: color 0.3s;
}

.legal-links a:hover {
    color: var(--color-gold);
}

.social-links {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.social-icon {
    color: var(--color-gold);
    transition: color 0.3s, transform 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.social-icon:hover {
    color: var(--color-gold-dim);
    transform: translateY(-2px);
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    font-size: 1.3rem;
    cursor: pointer;
}

/* Service Tabs Container (Mobile Accordion Logic) */
.service-tabs {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

@media (max-width: 768px) {

    /* Hide non-active buttons by default on mobile */
    .service-tabs .service-btn:not(.active) {
        display: none;
    }

    /* Show all when expanded */
    .service-tabs.expanded .service-btn {
        display: block;
    }

    /* Visual indicator for the active "Dropdown Header" */
    .service-tabs .service-btn.active {
        position: relative;
        background-color: var(--color-gold);
        color: var(--color-navy);
        padding-right: 3rem;
        /* Space for icon */
    }

    .service-tabs .service-btn.active::after {
        content: '▼';
        /* Down arrow */
        position: absolute;
        right: 1.5rem;
        top: 50%;
        transform: translateY(-50%);
        font-size: 1.5rem;
    }

    /* Flip arrow when expanded */
    .service-tabs.expanded .service-btn.active::after {
        transform: translateY(-50%) rotate(180deg);
    }
}

/* Horizontal Scroll Container */
.horizontal-scroll {
    display: flex;
    overflow-x: auto;
    gap: 2rem;
    padding-bottom: 2rem;
    /* Space for scrollbar */
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    /* Firefox */
    scrollbar-color: var(--color-gold) var(--border-color);
}

.horizontal-scroll::-webkit-scrollbar {
    height: 8px;
}

.horizontal-scroll::-webkit-scrollbar-track {
    background: var(--border-color);
    border-radius: 4px;
}

.horizontal-scroll::-webkit-scrollbar-thumb {
    background-color: var(--color-gold);
    border-radius: 4px;
}

.horizontal-scroll-card {
    min-width: 300px;
    max-width: 300px;
    flex: 0 0 auto;
    /* Prevent shrinking/growing */
    background: white;
    padding: 2rem;
    border-top: 4px solid var(--color-gold);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s;
}

.horizontal-scroll-card:hover {
    transform: translateY(-5px);
}

/* Dark Mode Horizontal Scroll */
body.dark-mode .horizontal-scroll-card {
    background-color: var(--bg-card);
    color: var(--color-text);
}

body.dark-mode .horizontal-scroll::-webkit-scrollbar-track {
    background: #334155;
}

@media (max-width: 980px) {
    .nav-links {
        display: none;
        /* Add JS toggle logic later */
        position: absolute;
        top: 80px;
        left: 0;
        width: 100%;
        background: var(--color-white);
        flex-direction: column;
        padding: 2rem;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
        z-index: 10;
    }

    /* Dark Mode Mobile Menu Fix */
    body.dark-mode .nav-links {
        background-color: #1e293b;
        /* Dark Slate to match header */
        border-bottom: 1px solid var(--border-color);
    }

    body.dark-mode .nav-links a {
        color: var(--color-text);
    }

    body.dark-mode .nav-links .search-input {
        background-color: #0f172a;
        /* Darker input background */
        border-color: #334155;
        color: white;
    }

    .nav-links.show {
        display: flex;
    }

    .menu-toggle {
        display: block;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    /* Mobile: Hero Buttons Stack */
    .hero-buttons {
        flex-direction: column;
        align-items: stretch;
        /* Make buttons full width for easier tapping */
    }

    .hero-buttons .btn {
        width: 100%;
        text-align: center;
    }

    /* Mobile: Team Card Stack */
    .team-card {
        grid-template-columns: 1fr;
        /* Stack vertically */
        text-align: center;
    }

    .team-img {
        max-width: 250px;
        /* Limit image size on mobile */
        margin: 0 auto;
    }

    /* Mobile: Logo Adjustment to prevent overflow */
    .navbar .logo {
        font-size: 1.5rem;
        /* Slightly smaller to fit with hamburger */
        white-space: normal;
        /* Allow wrapping if absolutely necessary on tiny screens? User asked for nowrap. Keep nowrap but shrink text if needed */
        max-width: 70%;
        overflow: hidden;
    }

    .navbar .logo span {
        font-size: 1.5rem !important;
        /* Override inline styles */
    }

    /* Mobile: Why Us Section Stack */
    .why-us-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    /* Ensure the "Advantage" card is underneath the text, which is default grid behavior (1st child, 2nd child) */

    /* Sticky Header on Mobile */
    .main-header {
        position: sticky;
        top: 0;
        z-index: 1000;
        width: 100%;
        /* Ensure parents don't mask it, though usually body overflow-x hidden is fine */
    }
}



@media (max-width: 545px) {

    /* Mobile: Logo Toggle (Emerging Due Diligence -> " " */
    .navbar .logo-text-desktop {
        display: none !important;
    }

}