/* ==========================================================================
   SPIF MASTER DESIGN SYSTEM & GRAPHICS ENGINE v4.2
   ========================================================================== */

/* --- 01. DESIGN TOKENS (CSS VARIABLES) --- */
:root {
    /* Color Palette: Light Mode */
    --bg-base: #fafaf9;          
    --bg-surface: #ffffff;       
    --bg-subtle: #f5f5f4;        
    --bg-overlay: rgba(250, 250, 249, 0.85);
    
    --text-primary: #1c1917;     
    --text-secondary: #57534e;   
    --text-muted: #a8a29e;       
    --text-inverse: #ffffff;
    
    /* Brand Colors */
    --brand-primary: #0284c7;    
    --brand-primary-hover: #0369a1;
    --brand-accent: #0d9488;     
    --brand-emergency: #e11d48;  
    --brand-emergency-hover: #be123c;
    --brand-gradient: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));

    /* Typography Scale (Fluid) */
    --text-xs: clamp(0.75rem, 0.7rem + 0.2vw, 0.85rem);
    --text-sm: clamp(0.875rem, 0.8rem + 0.25vw, 0.95rem);
    --text-base: clamp(1rem, 0.9rem + 0.35vw, 1.125rem);
    --text-md: clamp(1.125rem, 1rem + 0.4vw, 1.25rem);
    --text-lg: clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem);
    --text-xl: clamp(1.5rem, 1.3rem + 0.8vw, 2.25rem);
    --text-2xl: clamp(2rem, 1.8rem + 1.2vw, 2.75rem);
    --text-display: clamp(2.5rem, 2rem + 2.5vw, 4.5rem);

    /* Spacing Scale */
    --space-xxs: 0.25rem;
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 1.5rem;
    --space-lg: 2.5rem;
    --space-xl: 4rem;
    --space-2xl: 6rem;

    /* Borders & Geometry */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-pill: 999px;

    /* Shadows & Elevation */
    --shadow-sm: 0 4px 12px rgba(28, 25, 23, 0.04);
    --shadow-subtle: 0 8px 24px rgba(28, 25, 23, 0.06);
    --shadow-premium: 0 16px 40px rgba(28, 25, 23, 0.08), 0 4px 12px rgba(28, 25, 23, 0.04);
    --shadow-hover: 0 24px 48px rgba(28, 25, 23, 0.12), 0 8px 16px rgba(28, 25, 23, 0.04);

    /* Animation Timing */
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --transition-fast: 0.2s var(--ease-out-expo);
    --transition-base: 0.4s var(--ease-out-expo);
    --transition-slow: 0.8s var(--ease-out-expo);
}

/* Color Palette: Dark Mode */
[data-theme="dark"] {
    --bg-base: #0f172a;          
    --bg-surface: #1e293b;       
    --bg-subtle: #151e2e; /* FIX: Recalibrated from 0b1120 for better elevation contrast */        
    --bg-overlay: rgba(15, 23, 42, 0.85);

    --text-primary: #f8fafc;     
    --text-secondary: #cbd5e1;   
    --text-muted: #64748b;       
    --text-inverse: #f8fafc;

    --brand-primary: #38bdf8;    
    --brand-primary-hover: #7dd3fc;
    --brand-accent: #2dd4bf;     
    --brand-emergency: #fb7185;  
    --brand-emergency-hover: #fda4af;

    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.2);
    --shadow-subtle: 0 8px 24px rgba(0, 0, 0, 0.3);
    --shadow-premium: 0 16px 40px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0 24px 48px rgba(0, 0, 0, 0.5);
}

/* --- 02. RESET & NORMALIZATION --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { 
    font-family: 'Inter', system-ui, -apple-system, sans-serif; 
    background-color: var(--bg-base); 
    color: var(--text-primary); 
    line-height: 1.6; 
    overflow-x: hidden; 
    transition: background-color var(--transition-base), color var(--transition-base); 
}
img, svg, video { max-width: 100%; height: auto; display: block; }
a { text-decoration: none; color: inherit; transition: all var(--transition-fast); }
button, input, textarea { font-family: inherit; color: inherit; border: none; background: none; outline: none; }
button { cursor: pointer; }
ul, ol { list-style: none; }

/* Focus Accessibility */
:focus-visible { outline: 2px solid var(--brand-primary); outline-offset: 4px; border-radius: 2px; }
.skip-link { position: absolute; top: -100px; left: 1rem; background: var(--brand-primary); color: #fff; padding: 1rem; z-index: 9999; border-radius: var(--radius-sm); font-weight: bold; }
.skip-link:focus { top: 1rem; }

/* --- 03. LAYOUT & UTILITIES --- */
.container { width: 90%; max-width: 1200px; margin: 0 auto; }
.max-w-xs { max-width: 320px; }
.max-w-sm { max-width: 480px; }
.max-w-md { max-width: 768px; }
.max-w-prose { max-width: 65ch; } 
.mx-auto { margin-left: auto; margin-right: auto; }
.w-full { width: 100%; }
.h-full { height: 100%; }

/* FIX: Globally constrained section headers for perfect centering */
.section-header { max-width: 800px; margin-left: auto; margin-right: auto; }

/* Grid & Flexbox */
.grid { display: grid; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.flex-between { display: flex; justify-content: space-between; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.self-start { align-self: flex-start; }

/* Spacing Engine */
.gap-xxs { gap: var(--space-xxs); }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }
.pb-0 { padding-bottom: 0; }

.m-0 { margin: 0; }
.mt-auto { margin-top: auto; }
.mt-xs { margin-top: var(--space-xs); }
.mb-0 { margin-bottom: 0; }
.mb-xxs { margin-bottom: var(--space-xxs); }
.mb-xs { margin-bottom: var(--space-xs); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.p-0 { padding: 0; }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }
.p-xl { padding: var(--space-xl); }
.px-md { padding-left: var(--space-md); padding-right: var(--space-md); }
.px-lg { padding-left: var(--space-lg); padding-right: var(--space-lg); }
.py-xxs { padding-top: var(--space-xxs); padding-bottom: var(--space-xxs); }
.py-sm { padding-top: var(--space-sm); padding-bottom: var(--space-sm); }
.py-md { padding-top: var(--space-md); padding-bottom: var(--space-md); }
.py-lg { padding-top: var(--space-lg); padding-bottom: var(--space-lg); }
.py-xl { padding-top: var(--space-2xl); padding-bottom: var(--space-2xl); }

/* Colors & Backgrounds */
.bg-base { background-color: var(--bg-base); }
.bg-surface { background-color: var(--bg-surface); }
.bg-subtle { background-color: var(--bg-subtle); }
.surface-soft { background: var(--bg-surface); color: var(--text-primary); box-shadow: var(--shadow-sm); }

/* Borders & Geometry */
.border-y-subtle { border-top: 1px solid rgba(150,150,150,0.08); border-bottom: 1px solid rgba(150,150,150,0.08); }
.border-t-subtle { border-top: 1px solid rgba(150,150,150,0.08); }
.border-subtle { border: 1px solid rgba(150,150,150,0.1); }
.border-none { border: none; }
.border-radius-sm { border-radius: var(--radius-sm); }
.border-radius-md { border-radius: var(--radius-md); }
.border-radius-lg { border-radius: var(--radius-lg); }
.border-radius-xl { border-radius: var(--radius-xl); }
.border-radius-pill { border-radius: var(--radius-pill); }
.object-cover { object-fit: cover; }

/* Elevation & Effects */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-premium { box-shadow: var(--shadow-premium); border: 1px solid rgba(150, 150, 150, 0.05); }
.hover-lift { transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-fast); }
.hover-lift:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.opacity-5 { opacity: 0.05; }
.relative { position: relative; }
.absolute { position: absolute; }
.z-10 { z-index: 10; }
.overflow-hidden { overflow: hidden; }
.stretched-link::after { content: ''; position: absolute; inset: 0; z-index: 1; }

/* Rich Text / Prose Container */
/* Automatically styles internal margins for standard text pages (like Privacy Policy or long articles) without needing to add classes to every paragraph */
.prose { color: var(--text-secondary); line-height: 1.7; }
.prose p { margin-bottom: 1.5em; }
.prose h2, .prose h3 { color: var(--text-primary); margin-top: 2em; margin-bottom: 1em; }
.prose ul, .prose ol { margin-bottom: 1.5em; padding-left: 1.5em; }
.prose li { margin-bottom: 0.5em; }

/* Responsive Video Embeds */
/* Keeps YouTube/Vimeo embeds perfectly at 16:9 aspect ratio */
.video-wrapper { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; border-radius: var(--radius-lg); }
.video-wrapper iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; }

/* --- 04. TYPOGRAPHY ENGINE --- */
.display-text { font-size: var(--text-display); font-weight: 800; line-height: 1.1; letter-spacing: -0.03em; }
.heading-secondary { font-size: var(--text-xl); font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
.lead-text { font-size: var(--text-lg); line-height: 1.6; font-weight: 400; }
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-md { font-size: var(--text-md); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-newsreader { font-family: 'Newsreader', Georgia, serif; }
.italic { font-style: italic; }
.uppercase { text-transform: uppercase; }
.tracking-wide { letter-spacing: 0.05em; }
.leading-tight { line-height: 1.25; }
.leading-relaxed { line-height: 1.7; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-brand-primary { color: var(--brand-primary); }
.text-brand-emergency { color: var(--brand-emergency); }
.text-brand-accent { color: var(--brand-accent); }
.text-gradient { background: var(--brand-gradient); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.block { display: block; }
.inline-block { display: inline-block; }

/* --- 05. EDITORIAL & BLOG STYLES --- */
.editorial-content h2 { font-size: var(--text-xl); font-weight: 800; margin: 2.5rem 0 1rem; color: var(--text-primary); letter-spacing: -0.01em; }
.editorial-content h3 { font-size: var(--text-lg); font-weight: 700; margin: 2rem 0 0.75rem; color: var(--text-primary); }
.editorial-content p { margin-bottom: 1.5rem; color: var(--text-secondary); }
.editorial-content ul { list-style: disc; padding-left: 1.5rem; margin-bottom: 1.5rem; color: var(--text-secondary); }
.editorial-content li { margin-bottom: 0.5rem; }
.editorial-content a { color: var(--brand-primary); text-decoration: underline; text-underline-offset: 2px; }
.editorial-content a:hover { color: var(--brand-primary-hover); }
.editorial-content blockquote { border-left: 3px solid var(--brand-accent); padding-left: 1.5rem; margin: 2rem 0; }

/* --- 06. UI COMPONENTS --- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.85rem 1.75rem; border-radius: var(--radius-pill); font-size: var(--text-sm); font-weight: 600; letter-spacing: 0.01em; transition: all var(--transition-fast); cursor: pointer; text-decoration: none; }
.btn--primary { background: var(--brand-primary); color: #ffffff; box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--brand-primary-hover); transform: translateY(-2px); box-shadow: var(--shadow-premium); color: #ffffff; }
.btn--ghost { background: transparent; color: var(--text-primary); border: 1px solid rgba(150, 150, 150, 0.3); }
.btn--ghost:hover { background: var(--bg-subtle); transform: translateY(-2px); border-color: var(--text-primary); }
.btn--emergency { transition: transform var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast); }
.btn--emergency:hover { background: var(--brand-emergency-hover) !important; transform: scale(1.05); box-shadow: 0 0 20px rgba(225, 29, 72, 0.4); }
.btn--sm { padding: 0.6rem 1.25rem; font-size: var(--text-xs); }
.btn--lg { padding: 1.1rem 2.5rem; font-size: var(--text-base); }

/* FIX: Added width: fit-content so pills never elongate in flex columns */
.badge-pill { display: inline-flex; align-items: center; width: fit-content; max-width: 100%; }
.badge-minimal { font-size: 0.75rem; font-weight: 800; text-transform: uppercase; color: var(--brand-accent); display: block; letter-spacing: 0.05em; }

/* --- 07. SPECIFIC LAYOUTS & SECTIONS --- */
.site-header { position: fixed; top: 0; left: 0; right: 0; z-index: 100; background-color: var(--bg-overlay); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid rgba(150, 150, 150, 0.08); transition: transform var(--transition-base), background-color var(--transition-base); }
.site-header.is-hidden { transform: translateY(-100%); }
.menu-toggle-btn { display: none; align-items: center; justify-content: center; padding: 0.5rem; color: var(--text-secondary); border-radius: var(--radius-sm); transition: background var(--transition-fast), color var(--transition-fast); }
.menu-toggle-btn:hover { background: var(--bg-subtle); color: var(--brand-primary); }
.main-offset { padding-top: 76px; }
.nav-link { color: var(--text-secondary); transition: color var(--transition-fast); font-size: var(--text-sm); }
.nav-link:hover { color: var(--text-primary); }
.header-grid { display: flex; justify-content: space-between; align-items: center; height: 76px; }
.theme-toggle-btn { color: var(--text-secondary); transition: background var(--transition-fast), color var(--transition-fast); border-radius: var(--radius-sm); }
.theme-toggle-btn:hover { background: var(--bg-subtle); color: var(--brand-primary); }
.image-mask-wrapper { aspect-ratio: 4/3; }
.impact-stat--divided { border-left: 1px solid rgba(150, 150, 150, 0.12); padding-left: 2rem; }
/* Fix excessive bottom padding globally for all footers */
footer.site-footer { padding-bottom: 0 !important; }

/* FIX: Constrain impact stat numbers so they aren't monstrously huge on desktop */
.impact-stat .display-text { font-size: clamp(2rem, 1.5rem + 2vw, 3.25rem); line-height: 1; margin-bottom: 0.5rem; }

.bento-cell { padding: 2.5rem 2rem; position: relative; }
.bento-icon { font-size: 3rem; }
.icon-bg-large { font-size: 200px; opacity: 0.05; transition: transform var(--transition-slow); }
.initiative-card:hover .icon-bg-large { transform: scale(1.1) rotate(-5deg); }
.icon-foreground { font-size: 4rem; z-index: 1; }
.card-action { display: flex; flex-direction: column; }
.icon-bg { font-size: 160px; top: -20px; right: -20px; z-index: 0; pointer-events: none; transition: transform var(--transition-slow); }
.card-action:hover .icon-bg { transform: scale(1.1) rotate(-5deg); }

/* FIX: Force proper visibility on CTA backgrounds for light/dark mode */
.card-action .icon-bg { opacity: 0.12 !important; }
[data-theme="dark"] .card-action .icon-bg { opacity: 0.04 !important; }

details.accordion-item > summary { list-style: none; }
details.accordion-item > summary::-webkit-details-marker { display: none; }
details.accordion-item { transition: background var(--transition-fast); }
details[open].accordion-item { background: var(--bg-subtle); }
.drop-icon { transition: transform var(--transition-fast); }
details[open] .drop-icon { transform: rotate(180deg); }

/* Grid Systems (Highly Reusable Layouts) */
.hero-grid { grid-template-columns: 1.1fr 0.9fr; }
.bento-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.action-grid { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.blog-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.metrics-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); row-gap: 3rem; }
.initiative-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

/* Reveal Animations */
[data-reveal] { opacity: 0; transform: translateY(30px); transition: opacity 0.8s var(--ease-out-expo), transform 0.8s var(--ease-out-expo); will-change: opacity, transform; }
[data-reveal].is-revealed { opacity: 1; transform: translateY(0); }

/* --- 08. MASTER RESPONSIVE ENGINE --- */
@media (min-width: 1025px) {
    .hidden-desktop { display: none !important; }
    .footer-grid { grid-template-columns: 2fr 1.5fr 1fr 1fr; }
    details.footer-col > summary { pointer-events: none; cursor: default; }
}

@media (max-width: 1024px) {
    .hero-grid { grid-template-columns: 1fr; text-align: center; gap: 3rem; }
    .hero-content { display: flex; flex-direction: column; align-items: center; }
    .hero-actions { justify-content: center; }
    .image-mask-wrapper { order: -1; aspect-ratio: 16/9; max-height: 450px; }
    .initiative-grid { grid-template-columns: 1fr; }
    .initiative-media { min-height: 250px; }
    .footer-grid { grid-template-columns: repeat(2, 1fr); }
    .impact-stat--divided { border-left: none; padding-left: 0; }
}

@media (max-width: 768px) {
    .hidden-mobile { display: none !important; }
    .menu-toggle-btn { display: flex !important; }
    
    :root {
        --space-xl: 3.5rem;
        --space-2xl: 4.5rem;
    }

    /* Grid collapses */
    .bento-grid, .action-grid, .blog-grid, .metrics-grid { grid-template-columns: 1fr !important; }
    
    .hero-actions { flex-direction: column; width: 100%; }
    .hero-actions .btn { width: 100%; }
    
    .metrics-grid { gap: 0 !important; }
    .impact-stat { padding: 1.5rem 0; border-bottom: 1px solid rgba(150,150,150,0.1); }
    .impact-stat:last-child { border-bottom: none; }

    .footer-grid { grid-template-columns: 1fr; gap: 1rem; }
    .footer-brand { margin-bottom: 1.5rem; text-align: center; }
    .footer-brand .social-links { justify-content: center; }
    
    details.footer-col { background: var(--bg-surface); border-radius: var(--radius-md); border: 1px solid rgba(150,150,150,0.1); margin-bottom: 0.5rem; }
    details.footer-col > summary { padding: 1rem; margin: 0; display: flex; justify-content: space-between; align-items: center; }
    details.footer-col > summary::after { content: 'expand_more'; font-family: 'Material Symbols Rounded'; transition: transform var(--transition-fast); }
    details.footer-col[open] > summary::after { transform: rotate(180deg); }
    details.footer-col > .footer-links { padding: 0 1rem 1rem 1rem; }
    
    .nav-menu { display: none; position: fixed; top: 76px; left: 0; width: 100%; height: calc(100vh - 76px); background: var(--bg-surface); flex-direction: column; padding: 2rem; gap: 1.5rem; box-shadow: var(--shadow-premium); overflow-y: auto; z-index: 999; }
    .body-nav-open .nav-menu { display: flex; }
    .body-nav-open .hidden-mobile { display: flex !important; }
    .nav-menu .nav-item { width: 100%; }
    .nav-menu .nav-link { display: block; padding: 1rem 0; border-bottom: 1px solid rgba(150,150,150,0.1); font-size: 1.1rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
    [data-reveal] { opacity: 1; transform: none; transition: none; }
}

/* ==========================================================================
   09. HEADER DROPDOWN NAVIGATION
   ========================================================================== */
.has-dropdown { position: relative; }

/* Normalize button/link hybrid styles for the nav */
.nav-link { 
    display: flex; 
    align-items: center; 
    gap: 4px; 
    background: none; 
    border: none; 
    cursor: pointer; 
    padding: 0.5rem 0; 
    font-size: var(--text-sm); 
    color: var(--text-secondary);
    font-weight: 500;
    transition: color var(--transition-fast);
}

.nav-link:hover, 
.nav-link.is-active { 
    color: var(--brand-primary); 
}

.drop-icon { font-size: 1.25rem; transition: transform var(--transition-fast); }

/* Desktop Dropdown Behavior */
@media (min-width: 769px) {
    .dropdown-wrapper {
        position: absolute; 
        top: 100%; 
        left: -1rem;
        background: var(--bg-surface);
        border: 1px solid rgba(150,150,150,0.1);
        border-radius: var(--radius-md);
        box-shadow: var(--shadow-premium);
        padding: 0.5rem 0; 
        min-width: 240px;
        opacity: 0; 
        visibility: hidden;
        transform: translateY(10px);
        transition: all var(--transition-fast);
        z-index: 50;
    }
    
    /* Reveal on Hover or Keyboard Focus */
    .has-dropdown:hover .dropdown-wrapper,
    .has-dropdown:focus-within .dropdown-wrapper {
        opacity: 1; 
        visibility: visible; 
        transform: translateY(0);
    }
    
    .has-dropdown:hover .drop-icon,
    .has-dropdown:focus-within .drop-icon { 
        transform: rotate(180deg); 
    }
}

/* Mobile Dropdown Behavior */
@media (max-width: 768px) {
    .dropdown-wrapper {
        display: block; 
        padding-left: 1rem; 
        margin-top: 0.5rem;
        border-left: 2px solid rgba(150,150,150,0.1);
    }
    .has-dropdown { flex-direction: column; align-items: flex-start; }
    .drop-icon { display: none; }
}

/* Dropdown Menu Items */
.dropdown-menu { display: flex; flex-direction: column; margin: 0; padding: 0; }
.dropdown-menu a { 
    display: block; 
    padding: 0.75rem 1.5rem; 
    font-size: var(--text-sm); 
    font-weight: 500; 
    color: var(--text-secondary); 
    transition: background var(--transition-fast), color var(--transition-fast); 
}

.dropdown-menu a:hover,
.dropdown-menu a.is-active { 
    background: var(--bg-subtle); 
    color: var(--brand-primary); 
}

.icon-sm { font-size: 1.25rem; }

/* Offset adjustments for pages with the extra crisis banner */
.page-crisis .main-offset {
    padding-top: 130px; /* 76px nav + one-line banner on desktop */
}

@media (max-width: 768px) {
    .page-crisis .main-offset {
        padding-top: 160px; /* Increased padding for mobile text wrapping */
    }
}

/* Responsive Flex/Grid Ordering Utilities */
.order-1 { order: 1; }
.order-2 { order: 2; }

@media (min-width: 769px) {
    .md-order-1 { order: 1; }
    .md-order-2 { order: 2; }
}

/* Flex Growth Utilities */
.flex-grow-1 { flex-grow: 1; }

/* --- Ultimate Responsive Logo System --- */
.brand-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem; /* Space between the green mark and the text */
    height: 100%;
    text-decoration: none;
}

.nav-mark {
    height: 40px; /* Perfectly sized for your 76px header */
    width: auto;
    object-fit: contain;
}

.nav-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.nav-text-main {
    font-size: 1.15rem; /* Large, legible primary text */
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--text-primary); /* Flips to white in dark mode automatically */
}

.nav-text-sub {
    font-size: 0.85rem; /* Clean secondary text */
    font-weight: 500;
    line-height: 1.2;
    color: var(--text-secondary); /* Flips to light grey in dark mode */
}

/* Hide the text on very small phone screens to keep the header clean, keeping only the mark */
@media (max-width: 480px) {
    .nav-text { display: none; }
}


/* ==========================================================================
   AUTO-SCROLL MARQUEE (Clients & Media)
   ========================================================================== */
.marquee-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    display: flex;
    padding: 2rem 0;
}

/* Adds a gradient fade to the left and right edges */
.marquee-wrapper::before,
.marquee-wrapper::after {
    content: "";
    position: absolute;
    top: 0;
    width: 100px;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}
.marquee-wrapper::before {
    left: 0;
    background: linear-gradient(to right, var(--bg-base), transparent);
}
.marquee-wrapper::after {
    right: 0;
    background: linear-gradient(to left, var(--bg-base), transparent);
}

.marquee-track {
    display: flex;
    width: fit-content;
    /* Adjust '40s' to make the scroll faster or slower */
    animation: scroll-marquee 40s linear infinite; 
}

.marquee-track:hover {
    animation-play-state: paused;
}

.marquee-items {
    display: flex;
    align-items: center;
    gap: 3rem;
    padding-right: 3rem; /* Must exactly match the gap for a seamless loop */
}

.marquee-items img {
    height: 56px;
    width: auto;
    max-width: 180px;
    object-fit: contain;
    /* Standardizes the look for mixed JPG/PNGs in Dark Mode */
    background-color: #ffffff; 
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(150,150,150,0.1);
    box-shadow: var(--shadow-sm);
    /* Grayscale by default, color on hover */
    filter: grayscale(100%) opacity(0.7);
    transition: filter var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.marquee-items img:hover {
    filter: grayscale(0%) opacity(1);
    transform: translateY(-2px);
    box-shadow: var(--shadow-premium);
}

@keyframes scroll-marquee {
    0% { transform: translateX(0); }
    /* Shifts exactly 50% of the track width to loop the duplicated items perfectly */
    100% { transform: translateX(-50%); } 
}

/* Accessibility: Stop auto-scrolling for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    .marquee-track {
        animation-play-state: paused;
    }
}
