/* 
 * AI Reality Check - Main Stylesheet
 * A clean, Google-inspired design system with WCAG-compliant colors
 * Updated: April 2025
 */

/* ===== TABLE OF CONTENTS =====
 * 1. CSS Variables & Root
 * 2. Base Styles & Reset
 * 3. Typography
 * 4. Layout & Grid
 * 5. Components
 *    5.1 Header & Navigation
 *    5.2 Hero Sections
 *    5.3 Cards & Containers
 *    5.4 Buttons & Controls
 *    5.5 Forms & Inputs
 * 6. Case Study Specific Styles
 * 7. Utilities
 * 8. Responsive Styles
 */

/* ===== BASE STYLES ===== */
:root {
    /* Google-inspired color palette (with enhanced contrast values) */
    --primary-blue: #1a73e8; /* Adjusted for better contrast */
    --primary-blue-dark: #0d47a1; /* Darker blue for hover states */
    --primary-red: #d93025; /* Adjusted red for better contrast */
    --primary-yellow: #ea8600; /* Darkened yellow for better contrast */
    --primary-green: #188038; /* Adjusted green for better contrast */
    --neutral-dark: #202124;
    --neutral-medium: #5F6368;
    --neutral-light: #9AA0A6; /* Darkened for better contrast */
    --neutral-lighter: #F1F3F4;
    --white: #FFF;
    --black: #000;
    --surface: #FFF;
    
    /* For semi-transparent backgrounds with accessible contrast */
    --blue-bg: #e8f0fe; /* Solid color replacement for rgba(66, 133, 244, 0.1) */
    --green-bg: #e6f4ea; /* Solid color replacement for rgba(52, 168, 83, 0.1) */
    --yellow-bg: #fef7e0; /* Solid color replacement for rgba(251, 188, 5, 0.1) */
    --red-bg: #fce8e6; /* Solid color replacement for rgba(234, 67, 53, 0.1) */
    
    /* Footer & overlay colors with better contrast */
    --footer-link: #E8EAED; /* Light gray with good contrast on dark backgrounds */
    --footer-text: #FFF; /* Full white for text on dark backgrounds */
    --footer-overlay: rgb(0 0 0 / 95%); /* Even darker overlay for better text contrast */
    --footer-secondary: #FFF; /* Full white for better contrast */
    
    /* Border radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgb(60 64 67 / 30%);
    --shadow-md: 0 2px 6px rgb(60 64 67 / 15%);
    --shadow-lg: 0 4px 12px rgb(60 64 67 / 15%);
    
    /* Dark mode variables */
    --dark-surface: #121212;
    --dark-surface-elevated-1: #1E1E1E;
    --dark-surface-elevated-2: #222;
    --dark-surface-elevated-3: #252525;
    --dark-text-high: rgb(255 255 255 / 87%); /* ~4.5:1 contrast ratio */
    --dark-text-medium: rgb(255 255 255 / 60%); /* For less important text */
    --dark-border: #333;
    
    /* Dark mode color equivalents */
    --dark-primary-blue: #64B5F6; /* Lighter blue for dark mode with 4.5:1+ contrast */
    --dark-primary-blue-dark: #90CAF9; /* Even lighter for hover in dark mode */
    --dark-primary-red: #E57373; /* Lighter red for dark mode */
    --dark-primary-yellow: #FFD54F; /* Adjusted yellow for dark mode */
    --dark-primary-green: #81C784; /* Lighter green for dark mode */
    --dark-blue-bg: rgb(25 118 210 / 15%); /* Dark mode blue background */
    --dark-green-bg: rgb(67 160 71 / 15%); /* Dark mode green background */
    --dark-yellow-bg: rgb(251 140 0 / 15%); /* Dark mode yellow background */
    --dark-red-bg: rgb(211 47 47 / 15%); /* Dark mode red background */
    
    /* Shadows for dark mode */
    --dark-shadow-sm: 0 1px 2px rgb(0 0 0 / 90%);
    --dark-shadow-md: 0 2px 6px rgb(0 0 0 / 90%);
    --dark-shadow-lg: 0 4px 12px rgb(0 0 0 / 90%);
    
    /* Spacing system (8px grid) */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-xxl: 48px;
    
    /* Typography - Fluid system with clamp() for responsive scaling */
    --font-family: 'Roboto', sans-serif;
    --font-size-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
    --font-size-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
    --font-size-md: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
    --font-size-lg: clamp(1.125rem, 1rem + 0.5vw, 1.25rem);
    --font-size-xl: clamp(1.25rem, 1.1rem + 0.75vw, 1.5rem);
    --font-size-xxl: clamp(1.5rem, 1.3rem + 1vw, 2rem);
    --font-size-hero: clamp(2rem, 1.5rem + 2.5vw, 3rem);

    /* Line height adjustments for better readability */
    --line-height-tight: 1.25;
    --line-height-base: 1.6;
    --line-height-relaxed: 1.75;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    color: var(--neutral-dark);
    line-height: var(--line-height-base);
    background-color: var(--white);
}

img {
    max-width: 100%;
    height: auto;
}

a {
    color: var(--primary-blue);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-blue-dark);
    text-decoration: underline;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 500;
    line-height: var(--line-height-tight);
    margin-bottom: var(--space-md);
}

h1 {
    font-size: var(--font-size-hero);
}

h2 {
    font-size: var(--font-size-xxl);
}

h3 {
    font-size: var(--font-size-xl);
}

p {
    margin-bottom: var(--space-md);
}

/* Layout */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}

section {
    padding: var(--space-xxl) 0;
}

/* ===== COMPONENTS ===== */

/* Portfolio Preview Section */
.portfolio-preview {
    padding: var(--space-xl) 0;
    background-color: var(--neutral-lighter);
    border-bottom: 1px solid var(--neutral-light);
}

.portfolio-preview h2 {
    text-align: center;
    margin-bottom: var(--space-xl);
    color: var(--primary-blue);
    position: relative;
}

.portfolio-preview h2::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 3px;
    background-color: var(--primary-blue);
    border-radius: 2px;
}

/* Enhanced Hero Sections with Ken Burns effect */
.home-hero {
    position: relative;
    height: 50vh;
    min-height: 400px;
    background-image: url('../images/hero/hero-background.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    margin-bottom: var(--space-xl);
    filter: brightness(1.3) contrast(1.1);
    overflow: hidden;
    animation: kenBurns 20s ease-out infinite alternate;
}

.case-studies-hero,
.portfolio-hero,
.articles-hero {
    position: relative;
    height: 50vh;
    min-height: 400px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    margin-bottom: var(--space-xl);
    overflow: hidden;
    animation: kenBurns 20s ease-out infinite alternate;
}

.case-studies-hero {
    background-image: url('../images/hero/case-studies-hero.webp');
    filter: brightness(1.1) contrast(1.05);
    background-color: #0a0a17; /* Dark background for letterboxing */
}

.portfolio-hero {
    background-image: url('../images/hero/portfolio-hero.webp');
    filter: brightness(1.1) contrast(1.05);
    background-color: #0a0a17;
}

/* Ken Burns keyframe animation for hero sections */
@keyframes kenBurns {
    0% {
        transform: scale(1) translateZ(0);
    }

    100% {
        transform: scale(1.05) translateZ(0);
    }
}

/* Add gradient overlay for better text contrast if needed */
.hero-with-text::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to top,
        rgb(0 0 0 / 70%) 0%,
        transparent 100%);
    pointer-events: none;
}

/* Header and Navigation */
header {
    background-color: var(--white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: var(--space-md) 0;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo a {
    font-size: var(--font-size-xl);
    font-weight: 500;
    color: var(--neutral-dark);
    text-decoration: none;
}

nav ul {
    display: flex;
    list-style: none;
}

nav li {
    margin-left: var(--space-lg);
}

nav a {
    color: var(--neutral-dark); /* Improved contrast from medium to dark */
    font-weight: 500;
    text-decoration: none;
    padding: var(--space-xs) 0;
    position: relative;
}

nav a:hover {
    color: var(--primary-blue);
    text-decoration: none;
}

nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-blue);
    transition: width 0.2s ease;
}

nav a:hover::after {
    width: 100%;
}

/* Section Title (for page headers) */
.section-title {
    margin: 2rem 0 1.5rem;
    color: var(--primary-blue);
    text-align: center;
}

/* Profile Section */
.profile {
    background-color: var(--white);
    padding: var(--space-xxl) 0;
    border-top: 1px solid var(--neutral-lighter);
    border-bottom: 1px solid var(--neutral-lighter);
}

.profile-content {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-lg);
}

.profile-text {
    flex: 1;
    min-width: 300px;
}

.profile-highlight {
    background-color: var(--blue-bg); /* Using solid color instead of rgba */
    border-left: 4px solid var(--primary-blue);
    padding: var(--space-md);
    border-radius: 4px;
    margin: var(--space-lg) 0;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-md);
    margin: var(--space-lg) 0;
}

.metric {
    background-color: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: var(--space-md);
    text-align: center;
    transition: transform 0.2s ease;
}

.metric:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.metric h4 {
    font-size: var(--font-size-xxl);
    color: var(--primary-blue);
    margin-bottom: var(--space-xs);
}

.metric p {
    font-size: var(--font-size-sm);
    margin-bottom: 0;
}

/* Case Study Components */
.case-study-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.meta-item {
    background-color: var(--neutral-lighter);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    min-width: 200px;
    text-align: center;
}

.case-study-content {
    max-width: 900px;
    margin: 0 auto;
}

.case-study-content p {
    line-height: var(--line-height-relaxed);
    max-width: 70ch; /* Optimal reading width */
}

.problem-solution-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
    margin: var(--space-lg) 0;
}

.problem-section, .solution-section {
    background-color: var(--neutral-lighter);
    padding: var(--space-lg);
    border-radius: var(--radius-md);
}

.timeline {
    margin: var(--space-lg) 0;
}

.timeline-item {
    position: relative;
    padding-left: var(--space-xl);
    padding-bottom: var(--space-lg);
    border-left: 2px solid var(--primary-blue);
}

.timeline-item:last-child {
    border-left: none;
}

.timeline-item::before {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    background-color: var(--primary-blue);
    border-radius: 50%;
    left: -7px;
    top: 8px;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--space-lg);
    margin: var(--space-lg) 0;
}

.result-card {
    background-color: var(--neutral-lighter);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease;
}

.result-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.result-value {
    font-size: var(--font-size-xxl);
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: var(--space-sm);
}

.highlight-box {
    background-color: var(--blue-bg); /* Using solid color instead of rgba */
    border-left: 4px solid var(--primary-blue);
    padding: var(--space-lg);
    margin: var(--space-lg) 0;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.highlight-box.success {
    background-color: var(--green-bg); /* Using solid color instead of rgba */
    border-left-color: var(--primary-green);
}

.highlight-box.warning {
    background-color: var(--yellow-bg); /* Using solid color instead of rgba */
    border-left-color: var(--primary-yellow);
}

.client-quote {
    font-style: italic;
    background-color: var(--neutral-lighter);
    padding: var(--space-lg);
    margin: var(--space-lg) 0;
    border-radius: var(--radius-md);
    position: relative;
}

.client-quote footer {
    text-align: right;
    margin-top: var(--space-md);
    font-weight: 500;
}

/* Cards */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-lg);
}

/* Sophisticated card animations and hover states */
.card {
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: 0 2px 8px rgb(0 0 0 / 8%);
    padding: var(--space-lg);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Add gradient border on hover */
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg,
        var(--primary-blue) 0%,
        var(--primary-red) 25%,
        var(--primary-yellow) 50%,
        var(--primary-green) 75%,
        var(--primary-blue) 100%);
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.card:hover::before {
    transform: translateY(0);
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 32px rgb(0 0 0 / 12%);
}

.card h3 {
    margin-bottom: var(--space-sm);
}

.card p {
    flex-grow: 1; /* Make paragraphs take up available space */
}

.card .btn {
    align-self: flex-start; /* Align buttons at the bottom */
    margin-top: auto;
}

/* Stagger animation for card grids */
.cards .card {
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.cards .card:nth-child(1) { animation-delay: 0.1s; }
.cards .card:nth-child(2) { animation-delay: 0.2s; }
.cards .card:nth-child(3) { animation-delay: 0.3s; }
.cards .card:nth-child(4) { animation-delay: 0.4s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Video Card */
.video-card {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    aspect-ratio: 16/9;
    margin-bottom: var(--space-md);
    box-shadow: var(--shadow-sm);
    background-color: #fff;
}

.video-card iframe,
.video-card video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Video Styling */
.video-card video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background-color: black;
    cursor: pointer;
}

.video-card video:hover {
    opacity: 0.95;
}

/* Article Styles */
.article-content {
    max-width: 800px;
    margin: 0 auto;
    padding: var(--space-lg) 0;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    color: var(--neutral-dark); /* Improved contrast from medium to dark */
    font-size: var(--font-size-sm);
}

.article-introduction {
    font-size: var(--font-size-lg);
    color: var(--neutral-dark); /* Improved contrast from medium to dark */
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--neutral-light);
}

.article-content h2 {
    margin-top: var(--space-xl);
    margin-bottom: var(--space-md);
    color: var(--neutral-dark);
}

.article-content h3 {
    margin-top: var(--space-lg);
    margin-bottom: var(--space-sm);
    color: var(--neutral-dark);
}

.article-content p {
    margin-bottom: var(--space-md);
    line-height: var(--line-height-relaxed);
    max-width: 70ch; /* Optimal reading width */
}

.article-content ul, 
.article-content ol {
    margin-bottom: var(--space-lg);
    padding-left: var(--space-xl);
}

.article-content li {
    margin-bottom: var(--space-sm);
}

/* ===== 5.5 FORM COMPONENTS ===== */

/* Contact Form Components */
.contact-form {
    max-width: 600px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: var(--space-lg);
}

label {
    display: block;
    margin-bottom: var(--space-xs);
    font-weight: 500;
}

input, textarea {
    width: 100%;
    padding: var(--space-sm);
    border: 1px solid var(--neutral-light);
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: var(--font-size-md);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px var(--blue-bg); /* Using solid color instead of rgba */
}

input.invalid, textarea.invalid {
    border-color: var(--primary-red);
}

textarea {
    min-height: 150px;
    resize: vertical;
}

.checkbox-container {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
}

input[type="checkbox"] {
    width: auto;
    margin-top: 4px;
}

.checkbox-label {
    font-size: var(--font-size-sm);
    color: var(--neutral-dark); /* Improved contrast from medium to dark */
}

.form-status {
    margin-bottom: var(--space-md);
    min-height: 30px;
}

.status-message {
    padding: var(--space-md);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
}

.status-message.loading {
    background-color: var(--neutral-lighter);
    color: var(--neutral-dark); /* Improved contrast from medium to dark */
}

.status-message.success {
    background-color: var(--green-bg); /* Using solid color instead of rgba */
    color: var(--primary-green);
    border-left: 4px solid var(--primary-green);
}

.status-message.error {
    background-color: var(--red-bg); /* Using solid color instead of rgba */
    color: var(--primary-red);
    border-left: 4px solid var(--primary-red);
}

.contact-info {
    margin-top: var(--space-xxl);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-xl);
}

.contact-method {
    text-align: center;
    padding: var(--space-lg);
    background-color: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.contact-method:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.contact-method h3 {
    margin-bottom: var(--space-md);
    color: var(--primary-blue);
}

.contact-method .social-icons {
    display: flex;
    justify-content: center;
    gap: var(--space-md);
    margin-top: var(--space-md);
}

/* Modern button with ripple effect */
.btn {
    position: relative;
    overflow: hidden;
    display: inline-block;
    padding: 12px 32px;
    background: var(--primary-blue);
    color: white;
    border: none;
    border-radius: 24px;
    font-weight: 500;
    font-size: var(--font-size-md);
    letter-spacing: 0.5px;
    text-transform: none;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgb(255 255 255 / 30%);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover {
    background: var(--primary-blue-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgb(26 115 232 / 30%);
    color: white;
    text-decoration: none;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

/* Add pulse animation for CTAs */
.btn.primary {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgb(26 115 232 / 40%);
    }

    70% {
        box-shadow: 0 0 0 10px rgb(26 115 232 / 0%);
    }

    100% {
        box-shadow: 0 0 0 0 rgb(26 115 232 / 0%);
    }
}

/* Refined Footer Design */
footer {
    background: linear-gradient(135deg, #0a0a17 0%, #1a1a2e 100%);
    position: relative;
    padding: var(--space-xxl) 0 var(--space-xl) 0;
    margin-top: var(--space-xxl);
    color: var(--footer-text);
    min-height: 350px;
}

footer::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url('../images/footer/Dark UI Footer.webp');
    background-size: cover;
    background-position: center;
    opacity: 0.15; /* Much lighter overlay for artistic visibility */
    z-index: 0;
}

/* Add animated gradient border to footer */
footer::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg,
        var(--primary-blue) 0%,
        var(--primary-red) 25%,
        var(--primary-yellow) 50%,
        var(--primary-green) 75%,
        var(--primary-blue) 100%);
    background-size: 200% 100%;
    animation: gradientShift 3s ease infinite;
    z-index: 2;
}

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

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Skeleton loading animation for better perceived performance */
.skeleton {
    background: linear-gradient(90deg,
        var(--neutral-lighter) 25%,
        var(--neutral-light) 50%,
        var(--neutral-lighter) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
    border-radius: 4px;
}

.skeleton-title {
    height: 32px;
    width: 60%;
    margin-bottom: 16px;
    border-radius: 4px;
}

.skeleton-card {
    height: 200px;
    border-radius: var(--radius-md);
}

/* Progressive image loading with blur-up effect */
.progressive-image img {
    filter: blur(10px);
    transition: filter 0.3s ease;
}

.progressive-image img.loaded {
    filter: blur(0);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-xl);
    margin-bottom: var(--space-xl);
}

.footer-links h3,
.social-media h3 {
    color: var(--white);
}

.footer-links ul {
    list-style: none;
}

.footer-links li {
    margin-bottom: var(--space-sm);
}

.footer-links a {
    color: var(--footer-link); /* Brighter color for better contrast */
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: var(--white);
}

.social-icons {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-sm);
}

.social-icons a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: rgb(255 255 255 / 20%); /* Increased opacity for better contrast */
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.social-icons a:hover {
    transform: translateY(-2px);
    background-color: rgb(255 255 255 / 30%); /* Increased opacity for better contrast */
}

.copyright {
    text-align: center;
    color: var(--footer-secondary); /* Brighter text for better contrast */
    font-size: var(--font-size-sm);
    border-top: 1px solid rgb(255 255 255 / 20%); /* Increased opacity for better visibility */
    padding-top: var(--space-lg);
}

/* ===== UTILITIES ===== */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ===== RESPONSIVE STYLES ===== */

/* Mobile Navigation Toggle */
.mobile-nav-toggle {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: var(--space-xs);
    margin-left: auto;
    z-index: 101;
}

.mobile-nav-toggle .bar {
    display: block;
    width: 25px;
    height: 3px;
    margin: 5px 0;
    background-color: var(--neutral-dark); /* Improved contrast from medium to dark */
    border-radius: 3px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.mobile-nav-toggle.active .bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.mobile-nav-toggle.active .bar:nth-child(2) {
    opacity: 0;
}

.mobile-nav-toggle.active .bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* Enhanced mobile navigation system with backdrop blur */
@media (width <= 768px) {
    header {
        padding: var(--space-sm) 0;
    }

    header .container {
        position: relative;
    }

    .mobile-nav-toggle {
        display: block;
        position: absolute;
        right: var(--space-md);
        top: 50%;
        transform: translateY(-50%);
    }

    nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 85%;
        max-width: 320px;
        height: 100vh;
        background: linear-gradient(135deg, var(--white) 0%, var(--neutral-lighter) 100%);
        transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: -4px 0 24px rgb(0 0 0 / 15%);
        overflow-y: auto;
        padding-top: 80px;
        z-index: 1000;
    }

    nav.active {
        right: 0;
    }

    /* Add backdrop blur for modern feel */
    nav::before {
        content: '';
        position: fixed;
        top: 0;
        left: -100vw;
        width: 100vw;
        height: 100vh;
        background: rgb(0 0 0 / 40%);
        backdrop-filter: blur(4px);
        opacity: 0;
        transition: opacity 0.3s ease;
        pointer-events: none;
        z-index: -1;
    }

    nav.active::before {
        opacity: 1;
        pointer-events: all;
    }

    nav ul {
        flex-direction: column;
        align-items: stretch;
        padding: 0;
    }

    nav li {
        margin: 0;
        width: 100%;
    }

    /* Enhanced touch targets to minimum 44x44px */
    nav a {
        display: block;
        padding: 14px 20px;
        font-size: 18px;
        border-bottom: 1px solid var(--neutral-lighter);
        transition: background 0.2s ease, padding-left 0.2s ease;
        min-height: 44px;
        box-sizing: border-box;
    }

    nav a:active {
        background: var(--blue-bg);
        padding-left: 30px;
    }
}

@media (width <= 768px) {
    /* Typography adjustments */
    h1 {
        font-size: var(--font-size-xxl);
    }
    
    h2 {
        font-size: var(--font-size-xl);
    }
    
    h3 {
        font-size: var(--font-size-lg);
    }
    
    /* Layout adjustments */
    section {
        padding: var(--space-xl) 0;
    }
    
    /* Hero section improvements for mobile */
    .home-hero {
        height: 40vh; /* Reduced from 50vh */
        min-height: 300px; /* Reduced from 400px */
    }
    
    .case-studies-hero,
    .portfolio-hero,
    .articles-hero {
        height: 40vh; /* Reduced from 50vh */
        min-height: 300px; /* Reduced from 400px */
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }

    .problem-solution-container {
        grid-template-columns: 1fr;
    }
}

/* Small mobile screens */
@media (width <= 480px) {
    /* Additional hero adjustments for smaller screens */
    .home-hero {
        height: 30vh;
        min-height: 200px;
    }
    
    .case-studies-hero,
    .portfolio-hero,
    .articles-hero {
        height: 30vh;
        min-height: 200px;
    }
    
    /* Ensure hero image content is visible */
    .hero-image {
        object-position: center top;
    }
}

/* ===== 6. CASE STUDY SPECIFIC STYLES ===== */

/* Case Study Components */
.case-study-container {
    display: grid;
    grid-template-columns: minmax(250px, 1fr) minmax(0, 3fr);
    gap: var(--space-xl);
    margin: var(--space-xl) 0;
}

.sidebar {
    position: relative;
}

.case-study-content {
    background-color: var(--white);
    padding: var(--space-xl);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

.metadata {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
    color: var(--neutral-dark); /* Improved contrast from medium to dark */
    font-size: var(--font-size-sm);
}

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

.content-lead {
    font-size: var(--font-size-lg);
    color: var(--neutral-dark); /* Improved contrast from medium to dark */
    margin-bottom: var(--space-lg);
    padding-left: var(--space-md);
    border-left: 4px solid var(--primary-blue);
}

@media (width <= 992px) {
    .case-study-container {
        grid-template-columns: 1fr;
    }
    
    .sidebar .toc {
        position: static;
        margin-bottom: var(--space-lg);
    }
}

.case-study-section {
    margin-bottom: 2.5rem;
}

.highlight-box {
    background-color: var(--blue-bg); /* Using solid color instead of rgba */
    border-left: 4px solid var(--primary-blue);
    padding: var(--space-lg);
    margin: var(--space-lg) 0;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.highlight-box.success {
    background-color: var(--green-bg); /* Using solid color instead of rgba */
    border-left-color: var(--primary-green);
}

.highlight-box.warning {
    background-color: var(--yellow-bg); /* Using solid color instead of rgba */
    border-left-color: var(--primary-yellow);
}

.highlight-box.error {
    background-color: var(--red-bg); /* Using solid color instead of rgba */
    border-left-color: var(--primary-red);
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-lg);
    margin: var(--space-lg) 0;
}

.metric-card {
    background-color: var(--neutral-lighter);
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    text-align: center;
    transition: transform 0.2s ease;
}

.metric-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.metric-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 0.5rem;
}

.outcome-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--space-lg);
    margin: var(--space-lg) 0;
}

.outcome-card {
    background-color: var(--neutral-lighter);
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease;
}

.outcome-card:hover {
    transform: translateY(-5px);
}

.quote {
    font-style: italic;
    font-size: 1.5rem;
    max-width: 90%;
    margin: var(--space-xl) auto;
    position: relative;
    text-align: center;
    color: var(--neutral-dark); /* Improved contrast from medium to dark */
    padding: 0 var(--space-lg);
}

.quote::before, .quote::after {
    content: '"';
    font-size: 3rem;
    position: absolute;
    color: var(--primary-blue);
    opacity: 0.5; /* Increased opacity for better visibility */
}

.quote::before {
    top: -20px;
    left: 0;
}

.quote::after {
    bottom: -40px;
    right: 0;
}

.toc {
    background-color: var(--neutral-lighter);
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 100px;
    margin-bottom: var(--space-lg);
}

.toc-title {
    font-size: var(--font-size-lg);
    margin-bottom: var(--space-md);
    color: var(--primary-blue);
}

.toc-list {
    list-style-type: none;
}

.toc-item {
    margin-bottom: var(--space-md);
}

.toc-link {
    color: var(--neutral-dark); /* Improved contrast from medium to dark */
    transition: all 0.2s ease;
    display: block;
    padding: var(--space-xs) 0;
    border-left: 2px solid transparent;
    padding-left: var(--space-md);
}

.toc-link:hover, .toc-link.active {
    color: var(--primary-blue);
    border-left-color: var(--primary-blue);
    padding-left: var(--space-lg);
}

.image-container {
    margin: var(--space-lg) 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.image-container img {
    width: 100%;
    height: auto;
    display: block;
}

.image-caption {
    background-color: var(--neutral-lighter);
    padding: var(--space-md);
    font-size: var(--font-size-sm);
    color: var(--neutral-dark); /* Improved contrast from medium to dark */
    text-align: center;
}

/* ===== 7. UTILITIES ===== */

/* Iframe container for embedded content */

/* Portfolio Summary (replaced iframe) */
.portfolio-summary {
    background-color: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: var(--space-lg);
    margin: var(--space-lg) 0;
}

.profile-header {
    text-align: center;
    margin-bottom: var(--space-lg);
}

.profile-header h3 {
    color: var(--primary-blue);
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.profile-subtitle {
    color: var(--medium-gray);
    font-size: 1.1rem;
    font-style: italic;
}

.profile-highlights {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-md);
    margin-top: var(--space-md);
}

.highlight-item {
    text-align: center;
    padding: var(--space-md);
}

.highlight-item strong {
    display: block;
    color: var(--primary-blue);
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.highlight-item p {
    color: var(--medium-gray);
    line-height: 1.4;
    margin: 0;
}

.text-center {
    text-align: center;
}

/* ===== DARK MODE ===== */

/* Theme toggle button */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background-color: transparent;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    margin-left: var(--space-md);
    margin-right: calc(var(--space-md) * -1);
}

.theme-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--primary-blue);
}

.theme-toggle-icon {
    width: 24px;
    height: 24px;
    transition: transform 0.3s ease;
}

.theme-toggle-icon svg {
    width: 100%;
    height: 100%;
}

.theme-toggle[aria-pressed="true"] .theme-toggle-icon {
    transform: rotate(360deg);
}

/* Media query for system preferences */
@media (prefers-color-scheme: dark) {
    :root.theme-auto {
        /* Apply dark theme when system prefers dark and theme is set to auto */
        --primary-blue: var(--dark-primary-blue);
        --primary-blue-dark: var(--dark-primary-blue-dark);
        --primary-red: var(--dark-primary-red);
        --primary-yellow: var(--dark-primary-yellow);
        --primary-green: var(--dark-primary-green);
        --neutral-dark: var(--dark-text-high);
        --neutral-medium: var(--dark-text-medium);
        --neutral-light: rgb(255 255 255 / 30%);
        --neutral-lighter: var(--dark-surface-elevated-1);
        --white: var(--dark-surface);
        --surface: var(--dark-surface);
        --blue-bg: var(--dark-blue-bg);
        --green-bg: var(--dark-green-bg);
        --yellow-bg: var(--dark-yellow-bg);
        --red-bg: var(--dark-red-bg);
        --shadow-sm: var(--dark-shadow-sm);
        --shadow-md: var(--dark-shadow-md);
        --shadow-lg: var(--dark-shadow-lg);
    }
}

/* Manual dark theme toggle */
:root.theme-dark {
    --primary-blue: var(--dark-primary-blue);
    --primary-blue-dark: var(--dark-primary-blue-dark);
    --primary-red: var(--dark-primary-red);
    --primary-yellow: var(--dark-primary-yellow);
    --primary-green: var(--dark-primary-green);
    --neutral-dark: var(--dark-text-high);
    --neutral-medium: var(--dark-text-medium);
    --neutral-light: rgb(255 255 255 / 30%);
    --neutral-lighter: var(--dark-surface-elevated-1);
    --white: var(--dark-surface);
    --surface: var(--dark-surface);
    --blue-bg: var(--dark-blue-bg);
    --green-bg: var(--dark-green-bg);
    --yellow-bg: var(--dark-yellow-bg);
    --red-bg: var(--dark-red-bg);
    --shadow-sm: var(--dark-shadow-sm);
    --shadow-md: var(--dark-shadow-md);
    --shadow-lg: var(--dark-shadow-lg);
}

/* Dark mode specific overrides */
:root.theme-dark body, 
:root.theme-auto body {
    background-color: var(--dark-surface);
    color: var(--dark-text-high);
}

:root.theme-dark header, 
:root.theme-auto header {
    background-color: var(--dark-surface-elevated-1);
    box-shadow: var(--dark-shadow-sm);
}

:root.theme-dark .logo a, 
:root.theme-auto .logo a,
:root.theme-dark nav a, 
:root.theme-auto nav a {
    color: var(--dark-text-high);
}

:root.theme-dark .card, 
:root.theme-auto .card,
:root.theme-dark .result-card, 
:root.theme-auto .result-card,
:root.theme-dark .metric-card, 
:root.theme-auto .metric-card {
    background-color: var(--dark-surface-elevated-1);
    box-shadow: var(--dark-shadow-md);
}

:root.theme-dark footer::before, 
:root.theme-auto footer::before {
    background-color: rgb(0 0 0 / 95%);
}

:root.theme-dark .mobile-nav-toggle .bar, 
:root.theme-auto .mobile-nav-toggle .bar {
    background-color: var(--dark-text-high);
}

/* Add icons using CSS to avoid external dependencies */
.icon-linkedin::before,
.icon-twitter::before,
.icon-github::before,
.icon-medium::before,
.icon-substack::before,
.icon-youtube::before {
    display: inline-block;
    width: 24px;
    height: 24px;
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    content: '';
    filter: brightness(1.5); /* Make icons brighter for dark footer */
}

.icon-linkedin::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%23FFFFFF' d='M19 3a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14m-.5 15.5v-5.3a3.26 3.26 0 0 0-3.26-3.26c-.85 0-1.84.52-2.32 1.3v-1.11h-2.79v8.37h2.79v-4.93c0-.77.62-1.4 1.39-1.4a1.4 1.4 0 0 1 1.4 1.4v4.93h2.79M6.88 8.56a1.68 1.68 0 0 0 1.68-1.68c0-.93-.75-1.69-1.68-1.69a1.69 1.69 0 0 0-1.69 1.69c0 .93.76 1.68 1.69 1.68m1.39 9.94v-8.37H5.5v8.37h2.77z'/%3E%3C/svg%3E");
}

.icon-twitter::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%23FFFFFF' d='M22.46 6c-.77.35-1.6.58-2.46.69.88-.53 1.56-1.37 1.88-2.38-.83.5-1.75.85-2.72 1.05C18.37 4.5 17.26 4 16 4c-2.35 0-4.27 1.92-4.27 4.29 0 .34.04.67.11.98C8.28 9.09 5.11 7.38 3 4.79c-.37.63-.58 1.37-.58 2.15 0 1.49.75 2.81 1.91 3.56-.71 0-1.37-.2-1.95-.5v.03c0 2.08 1.48 3.82 3.44 4.21a4.22 4.22 0 0 1-1.93.07 4.28 4.28 0 0 0 4 2.98 8.521 8.521 0 0 1-5.33 1.84c-.34 0-.68-.02-1.02-.06C3.44 20.29 5.7 21 8.12 21 16 21 20.33 14.46 20.33 8.79c0-.19 0-.37-.01-.56.84-.6 1.56-1.36 2.14-2.23z'/%3E%3C/svg%3E");
}

.icon-github::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%23FFFFFF' d='M12 2A10 10 0 0 0 2 12c0 4.42 2.87 8.17 6.84 9.5.5.08.66-.23.66-.5v-1.69c-2.77.6-3.36-1.34-3.36-1.34-.46-1.16-1.11-1.47-1.11-1.47-.91-.62.07-.6.07-.6 1 .07 1.53 1.03 1.53 1.03.87 1.52 2.34 1.07 2.91.83.09-.65.35-1.09.63-1.34-2.22-.25-4.55-1.11-4.55-4.92 0-1.11.38-2 1.03-2.71-.1-.25-.45-1.29.1-2.64 0 0 .84-.27 2.75 1.02.79-.22 1.65-.33 2.5-.33.85 0 1.71.11 2.5.33 1.91-1.29 2.75-1.02 2.75-1.02.55 1.35.2 2.39.1 2.64.65.71 1.03 1.6 1.03 2.71 0 3.82-2.34 4.66-4.57 4.91.36.31.69.92.69 1.85V21c0 .27.16.59.67.5C19.14 20.16 22 16.42 22 12A10 10 0 0 0 12 2z'/%3E%3C/svg%3E");
}

.icon-medium::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%23FFFFFF' d='M4.37 7.46h.75v10.05c0 .55-.45.94-.95.94h-.55v-10.4c0-.33.28-.59.6-.59h.15m1.5.59h4.35l3.1 7 3.45-7h4.1v10.73c0 .33-.28.67-.62.67h-.68v-9.95l-3.55 7.13h-1.4l-3.5-7v6.8h-2.25v-8.38m19.38-.59c.33 0 .62.28.62.6v10.68c0 .35-.3.67-.65.67h-4.25v-12h4.22c.02 0 .04 0 .06 0.03'/%3E%3C/svg%3E");
}

.icon-substack::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%23FFFFFF' d='M22 6.7H2l-.2-2h20.4c-.1.6-.2 1.3-.2 2zm-19.8 5.3h17.6c0-.7.1-1.3.2-2H2c.1.7.2 1.3.2 2zm-.2 6h20.4c0-.7.1-1.3.2-2H2l-.2 2z'/%3E%3C/svg%3E");
}

.icon-youtube::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%23FFFFFF' d='M10 15l5.19-3L10 9v6m11.56-7.83c.13.47.22 1.1.28 1.9.07.8.1 1.49.1 2.09L22 12c0 2.19-.16 3.8-.44 4.83-.25.9-.83 1.48-1.73 1.73-.47.13-1.33.22-2.65.28-1.3.07-2.49.1-3.59.1L12 19c-4.19 0-6.8-.16-7.83-.44-.9-.25-1.48-.83-1.73-1.73-.13-.47-.22-1.1-.28-1.9-.07-.8-.1-1.49-.1-2.09L2 12c0-2.19.16-3.8.44-4.83.25-.9.83-1.48 1.73-1.73.47-.13 1.33-.22 2.65-.28 1.3-.07 2.49-.1 3.59-.1L12 5c4.19 0 6.8.16 7.83.44.9.25 1.48.83 1.73 1.73z'/%3E%3C/svg%3E");
}