/* CSS Reset and Base Styles */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: var(--color-background);
    color: var(--color-text);
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

img, picture, svg {
    max-width: 100%;
    display: block;
}

input, button, textarea, select {
    font: inherit;
}

/* Root Variables for Theming */
:root {
    --color-primary: #005fcc;
    --color-primary-darker: #004c99;
    --color-accent: #ffc107;
    --color-text: #212529;
    --color-text-muted: #525c63;;
    --color-background: #ffffff;
    --color-surface: #f8f9fa;
    --color-border: #dee2e6;
    
    --font-family-base: 'Inter', sans-serif;
    --font-size-base: 1rem;
    --font-weight-normal: 400;
    --font-weight-bold: 700;

    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 1.5rem;
    --space-lg: 2rem;
    --space-xl: 3rem;
    --space-xxl: 5rem;

    --border-radius: 0.5rem;
    --box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    --transition-speed: 0.2s ease-in-out;

    /* IMPROVEMENT: Z-index variables for managing stacking context */
    --z-index-hamburger: 1001;
    --z-index-nav-menu: 1000;
    --z-index-skip-link: 1000;
    --z-index-header: 999;
}

[data-theme="dark"] {
    --color-primary: #4dabf7;
    --color-primary-darker: #228be6;
    --color-accent: #ffd43b;
    --color-text: #e9ecef;
    --color-text-muted: #adb5bd;
    --color-background: #121212;
    --color-surface: #1e1e1e;
    --color-border: #495057;
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

[data-theme="high-contrast"] {
    --color-primary: #0000ff;
    --color-primary-darker: #0000cc;
    --color-accent: #ffff00;
    --color-text: #000000;
    --color-text-muted: #202020;
    --color-background: #ffffff;
    --color-surface: #f0f0f0;
    --color-border: #000000;
    --box-shadow: 0 0 0 1px #000;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--space-sm);
    padding-right: var(--space-sm);
}

/* Accessibility */
.skip-link {
    position: absolute;
    top: -50px;
    left: 0;
    background: var(--color-primary);
    color: var(--color-background);
    padding: var(--space-xs) var(--space-sm);
    z-index: var(--z-index-skip-link);
    transition: top var(--transition-speed);
}
.skip-link:focus {
    top: 0;
}

.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;
}

/* General Typography & Buttons */
h1, h2, h3, h4 {
    font-weight: var(--font-weight-bold);
    line-height: 1.2;
    color: var(--color-text);
}

h1 { font-size: clamp(2.25rem, 5vw, 3.5rem); margin-bottom: var(--space-sm); }
h2 { font-size: clamp(1.75rem, 4vw, 2.5rem); margin-bottom: var(--space-lg); text-align: center; }
h3 { font-size: 1.35rem; margin-bottom: var(--space-sm); }
h4 { font-size: 1.15rem; margin-bottom: var(--space-xs); }
p { max-width: 75ch; margin-bottom: var(--space-sm); color: var(--color-text-muted); }

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-speed);
}

a:hover, a:focus-visible {
    text-decoration: underline;
    color: var(--color-primary-darker);
}

p a, .stat-card .label a, .service-card p a, .expertise-item p a, .process-step p a {
    text-decoration: underline;
    text-underline-offset: 3px;
}

p a:hover, p a:focus-visible {
    color: var(--color-primary-darker);
}


.cta-button {
    display: inline-block;
    background-color: var(--color-primary);
    color: var(--color-background);
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--border-radius);
    font-weight: var(--font-weight-bold);
    text-decoration: none;
    transition: background-color var(--transition-speed), transform var(--transition-speed);
    margin-top: var(--space-md);
}
.cta-button:hover, .cta-button:focus-visible {
    background-color: var(--color-primary-darker);
    text-decoration: none;
    transform: translateY(-2px);
    color: var(--color-background);
}

button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 3px;
    border-radius: var(--border-radius);
}

/* Header and Navigation */
.main-header {
    background-color: var(--color-background);
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: var(--z-index-header);
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-sm);
}

.nav-logo a {
    font-weight: var(--font-weight-bold);
    font-size: 1.5rem;
    text-decoration: none;
    color: var(--color-text);
}
.nav-logo a:hover { text-decoration: none; }
.nav-links { display: flex; gap: var(--space-md); list-style: none; }
.nav-links a { font-weight: var(--font-weight-bold); text-decoration: none; padding: var(--space-xs) 0; position: relative; }
.nav-links a::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: var(--color-primary);
    transform: scaleX(0);
    transform-origin: bottom right;
    transition: transform 0.25s ease-out;
}
.nav-links a:hover::after, .nav-links a:focus-visible::after {
    transform: scaleX(1);
    transform-origin: bottom left;
}
.nav-links a.active-section {
    color: var(--color-primary);
}
.nav-links a.active-section::after {
    transform: scaleX(1);
    transform-origin: bottom left;
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 999px;
    color: var(--color-text);
    display: flex;
    align-items: center;
    justify-content: center;
}
.theme-toggle:hover { background-color: var(--color-surface); }
.theme-toggle svg { width: 24px; height: 24px; }

.hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: var(--z-index-hamburger);
}

.hamburger .bar {
    display: block;
    width: 25px; 
    height: 3px;
    margin: 5px auto;
    background-color: var(--color-text);
    transition: all var(--transition-speed);
}

/* Main Content Sections */
main section { 
    padding: var(--space-xxl) 0;
    scroll-margin-top: 5rem; 
}

#home { 
    text-align: center; 
    padding-top: var(--space-xl);
    padding-bottom: var(--space-xxl);
}
#home p { 
    text-align: left;
    max-width: 65ch; 
    margin: 0 auto; 
    font-size: 1.25rem; 
    color: var(--color-text-muted); 
}

/* Mission Section */
#mission .mission-content {
    max-width: 800px;
    margin: 0 auto;
}
#mission .mission-content h1 {
    text-align: center;
}
#mission .mission-content p {
    margin-left: auto;
    margin-right: auto;
}

#mission p {
    font-size: 1.25rem;
}

/* Angled Sections using clip-path */
#mission, #process {
    background-color: var(--color-surface);
}
#mission {
    clip-path: polygon(0 0, 100% 4%, 100% 100%, 0 96%);
}
#process {
    clip-path: polygon(0 4%, 100% 0, 100% 96%, 0 100%);
}


/* Problem Section (Stats) */
#problem { background-color: var(--color-background); }
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-lg);
    text-align: center;
}
.stat-card {
    text-align: left;
    background-color: var(--color-surface);
    padding: var(--space-lg);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}
.stat-card .number {
    font-size: clamp(3rem, 8vw, 4.5rem);
    font-weight: var(--font-weight-bold);
    color: var(--color-primary);
    line-height: 1;
    margin-bottom: var(--space-sm);
}
.stat-card .label {
    text-align: left;
    font-size: 1rem;
    color: var(--color-text);
}

/* Services Section with Cards */
#services {
    background-color: var(--color-surface);
}
.services-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); 
    gap: var(--space-md); 
}
.service-card {
    background-color: var(--color-background);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: var(--space-md);
    box-shadow: var(--box-shadow);
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
    display: flex;
    flex-direction: column;
}
.service-card:hover { 
    transform: translateY(-8px); 
    box-shadow: 0 12px 24px rgba(0,0,0,0.12); 
}
.service-card .icon { 
    width: 48px; 
    height: 48px; 
    margin-bottom: var(--space-sm); 
    color: var(--color-primary); 
}
.service-card p {
    flex-grow: 1; 
}

/* Expertise Section */
#expertise { background-color: var(--color-background); }
.expertise-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-lg);
    align-items: start;
}
.expertise-item {
    text-align: center;
}
.expertise-item h3 {
     margin-top: var(--space-sm);
}
.expertise-item p {
    text-align: left;
    max-width: 60ch;
    margin-left: auto;
    margin-right: auto;
}

/* Process Section (Timeline) */
#process {
    background-color: var(--color-surface);
}
.process-timeline {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-lg);
    position: relative;
}
.process-step {
    padding: var(--space-md);
    background-color: var(--color-background);
    border-radius: var(--border-radius);
    position: relative;
    padding-left: 4.5rem; 
}
.process-step::before {
    counter-increment: step-counter;
    content:  counter(step-counter);
    position: absolute;
    left: var(--space-sm);
    top: var(--space-md); 
    font-size: 2.5rem;
    font-weight: var(--font-weight-bold);
    color: var(--color-primary);
    opacity: 0.5;
    line-height: 1; 
}

/* Contact Section */
#contact { background-color: var(--color-background); }
#contact p {
    text-align: center; 
    max-width: 65ch; 
    margin-left: auto; 
    margin-right:auto; 
    margin-bottom: var(--space-lg);
}

/* Footer */
.main-footer {
    background-color: #1e1e1e;
    color: #e9ecef; 
    padding: var(--space-lg) 0;
    text-align: center;
}
.main-footer a { color: var(--color-accent); }
.main-footer address { font-style: normal; line-height: 1.8; }

/* Corrected Theme Icon Visibility */
.theme-toggle svg {
    display: none;
}
body[data-theme="light"] .icon-moon {
    display: block;
}
body[data-theme="dark"] .icon-contrast {
    display: block;
}
body[data-theme="high-contrast"] .icon-sun {
    display: block;
}


/* Language Switcher Styles */
.lang-switcher { display: flex; gap: 0.5rem; }
.lang-switcher button { 
    background: none; 
    border: 1px solid var(--color-border); 
    border-radius: var(--border-radius); 
    padding: 0.3rem 0.6rem; 
    cursor: pointer; 
    font-weight: bold; 
    color: var(--color-text);
    transition: background-color var(--transition-speed), color var(--transition-speed);
}
.lang-switcher button[aria-current="page"] { 
    background-color: var(--color-primary); 
    color: var(--color-background); 
    border-color: var(--color-primary); 
}

/* Email Copy Button Styles */
.email-copy-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-xs);
    background-color: var(--color-surface);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--border-radius);
    border: 1px solid var(--color-border);
    max-width: 100%;
    margin: var(--space-sm) auto 0;
}

.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background-color: transparent;
    border: 1px solid transparent;
    color: var(--color-primary);
    padding: 0.3rem 0.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: var(--font-weight-bold);
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

.copy-btn:hover, .copy-btn:focus-visible {
    background-color: var(--color-primary);
    color: var(--color-background);
    text-decoration: none;
}

.copy-btn .icon-copy {
    width: 18px;
    height: 18px;
}

.copy-btn.copied {
    background-color: #28a745; 
    color: #ffffff;
    cursor: default;
}

[data-theme="dark"] .copy-btn.copied {
    background-color: #218838;
}

[data-theme="high-contrast"] .copy-btn.copied {
    background-color: #000000;
    color: #ffff00;
    border: 1px solid #ffff00;
}

/* 404 Page Styles */
.not-found-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: calc(100vh - 250px); 
    padding: var(--space-lg) 0;
}
.not-found-title {
    font-size: clamp(6rem, 20vw, 10rem);
    font-weight: 700;
    line-height: 1;
    color: var(--color-primary);
    opacity: 0.8;
    margin-bottom: var(--space-sm);
}
.not-found-container h2 {
    font-size: clamp(1.75rem, 5vw, 2.5rem);
    margin-bottom: var(--space-md);
}
.not-found-container p {
    max-width: 60ch;
    margin-bottom: var(--space-lg);
}


/* Responsive Styles */
@media (min-width: 769px) {
    .process-timeline {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    /* FIX: No longer need to redeclare navbar properties here */
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 70%;
        max-height: 100vh;
        background-color: var(--color-surface);
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        transition: right 0.3s ease-in-out;
        box-shadow: -5px 0 15px rgba(0,0,0,0.1);
        padding-top: var(--space-xxl);
        overflow-y: auto;
        padding-bottom: var(--space-xxl);
        padding-left: var(--space-xs);
        padding-right: var(--space-xs);
        z-index: var(--z-index-nav-menu);
    }
    
    #home p {
        text-align: left;
        margin-left:0;
        margin-right: 0;
    }
    
    .nav-links.active { right: 0; }
    .nav-links li { width: 100%; text-align: center; }
    .nav-links a { font-size: 1.25rem; padding: var(--space-md) 0; display: block; }
    .nav-controls { gap: var(--space-sm); }
    .hamburger { display: block; }
    .hamburger.active .bar:nth-child(2) { opacity: 0; }
    .hamburger.active .bar:nth-child(1) { transform: translateY(8px) rotate(45deg); }
    .hamburger.active .bar:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }
    
    [data-theme="high-contrast"] .nav-links {
        scrollbar-width: thin;
        scrollbar-color: var(--color-text) var(--color-surface);
    }
    [data-theme="high-contrast"] .nav-links::-webkit-scrollbar {
        width: 12px;
    }
    [data-theme="high-contrast"] .nav-links::-webkit-scrollbar-track {
        background: var(--color-surface);
        border-left: 1px solid var(--color-border);
    }
    [data-theme="high-contrast"] .nav-links::-webkit-scrollbar-thumb {
        background-color: var(--color-text);
        border: 2px solid var(--color-surface);
        border-radius: 6px;
    }
}

@media (max-width: 360px) {
    .navbar {
        gap: var(--space-xs);
    }
    .nav-logo a {
        font-size: 1.25rem;
    }
    .nav-controls {
        gap: var(--space-xs);
    }
    .lang-switcher button {
        padding: 0.2rem 0.4rem;
        font-size: 0.9rem;
    }
}

/* Accessibility: Respect user preference for reduced motion */
@media (prefers-reduced-motion: reduce) {
  /* Turn off all animations and transitions */
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

