:root {
    /* Palette de couleurs */
    --color-bg: #0a0a0a;
    --color-text: #ffffff;
    --color-primary: #7c3aed;
    --color-secondary: #ec4899;
    --color-accent: #00d4ff;
    --color-primary-t-30: rgba(124, 58, 237, 0.3);
    --color-primary-t-50: rgba(124, 58, 237, 0.5);
    --color-secondary-t-80: rgba(236, 72, 153, 0.8);
    --color-secondary-t-100: rgba(236, 72, 153, 1);
    --color-accent-t-10: rgba(0, 212, 255, 0.1);
    --color-accent-t-20: rgba(0, 212, 255, 0.2);
    --color-white-t-05: rgba(255, 255, 255, 0.05);
    --color-white-t-08: rgba(255, 255, 255, 0.08);
    --color-white-t-10: rgba(255, 255, 255, 0.1);
    --color-white-t-12: rgba(255, 255, 255, 0.12);
    --color-white-t-30: rgba(255, 255, 255, 0.3);
    --color-white-t-70: rgba(255, 255, 255, 0.7);
    --color-dropdown-bg: #1c1c1c;

    /* Bordures et rayons */
    --radius-sm: 0.5rem;
    --radius-md: 1rem;
    --radius-lg: 1.5rem;
    --radius-xl: 2rem;

    /* Espacements */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 2rem;
    --spacing-lg: 4rem;
    --spacing-xl: 6rem;

    /* Ombres */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.2);
    --shadow-glow: 0 0 24px rgba(0, 217, 255, 0.3);

    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-base: 300ms ease-in-out;
    --transition-slow: 500ms ease-in-out;
}

body.light-mode {
    --color-bg: #fff;
    --color-text: #1a1a1a;
    --color-primary: #7c3aed;
    --color-secondary: #ec4899;
    --color-accent: #00aaff;
    --color-primary-t-30: rgba(124, 58, 237, 0.3);
    --color-primary-t-50: rgba(124, 58, 237, 0.5);
    --color-secondary-t-80: rgba(236, 72, 153, 0.8);
    --color-secondary-t-100: rgba(236, 72, 153, 1);
    --color-accent-t-10: rgba(0, 170, 255, 0.1);
    --color-accent-t-20: rgba(0, 170, 255, 0.2);
    --color-white-t-05: rgba(0, 0, 0, 0.05);
    --color-white-t-08: rgba(0, 0, 0, 0.08);
    --color-white-t-10: rgba(0, 0, 0, 0.1);
    --color-white-t-12: rgba(0, 0, 0, 0.12);
    --color-white-t-30: rgba(0, 0, 0, 0.3);
    --color-white-t-70: rgba(0, 0, 0, 0.7);
    --color-dropdown-bg: #f8f8f8;
}

body.light-mode .main-header {
    background: rgba(255, 255, 255, 0.8);
}

.theme-icon {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Accessibility helper class */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

html,
body {
    height: 100%; /* Ensure html and body take full viewport height for scroll snapping */
}

body {
    font-family:
        "Inter",
        -apple-system,
        BlinkMacSystemFont,
        sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    overflow-x: hidden;
    line-height: 1.6;
    scroll-behavior: smooth;
}

.container {
    position: relative;
}

/* Background Animation */
.bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.7;
}

/* Hero Section */
.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    scroll-snap-align: start;
}

.hero-content {
    text-align: center;
    z-index: 2;
    transform: translateY(50px);
    opacity: 0;
    animation: fadeInUp 1.5s ease forwards;
}

.hero h1 {
    font-size: clamp(3rem, 8vw, 8rem);
    font-weight: 900;
    background: linear-gradient(
        135deg,
        var(--color-accent),
        var(--color-primary),
        var(--color-secondary)
    );
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 4s ease-in-out infinite;
    letter-spacing: -0.02em;
}

.hero p {
    font-size: clamp(1.2rem, 3vw, 2rem);
    opacity: 0.8;
    padding-bottom: 2rem;
    padding-left: 4rem;
    padding-right: 4rem;
    animation: fadeInUp 1.5s ease 0.3s forwards;
    opacity: 0;
}

.hero-tags {
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 3rem;
    animation: fadeInUp 1s ease-out 0.4s backwards;
}

.tag {
    padding: 0.5rem 1rem;
    background: var(--color-white-t-05);
    backdrop-filter: blur(10px);
    border: 1px solid var(--color-white-t-10);
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text);
}

.cta-button {
    display: inline-block;
    padding: 1rem 2rem;
    background: linear-gradient(
        135deg,
        var(--color-primary),
        var(--color-secondary)
    );
    border: none;
    border-radius: var(--radius-xl);
    color: var(--color-text);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    transition: var(--transition-smooth);
    animation: fadeInUp 1.5s ease 0.6s forwards;
    opacity: 0;
    position: relative;
    overflow: hidden;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 40px var(--color-primary-t-30);
}

.cta-button::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    transition: left 0.5s;
}

.cta-button:hover::before {
    left: 100%;
}

/* Sections */
.section {
    min-height: 100vh;
    padding: 5rem 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    scroll-snap-align: start;
}

.section-content {
    max-width: 1200px;
    width: 95%;
    transform: translateY(100px);
    opacity: 0;
    transition: all 1s ease;
}

.section-content.visible {
    transform: translateY(0);
    opacity: 1;
}

.section h2 {
    position: relative;
    z-index: 1001;
    font-size: clamp(2.5rem, 6vw, 5rem);
    font-weight: 800;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, var(--color-text), #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section p {
    font-size: clamp(1.1rem, 2.5vw, 1.5rem);
    opacity: 0.9;
    margin-bottom: 2rem;
}

/* Cards */
.card {
    background: var(--color-dropdown-bg);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--color-dropdown-bg);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition-base);
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

.card:hover::before {
    transform: scaleX(1);
}

.card-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-accent);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-sm);
    color: white;
    font-size: 2rem;
    margin-left: 35%;
}

.card-title {
    font-size: 1.5rem;
    margin-bottom: var(--spacing-sm);
    color: var(--primary-dark);
}

.card-description {
    color: var(--neutral-gray);
    line-height: 1.7;
}

.card p {
    font-size: 1.3rem;
}

/* GRID LAYOUTS */
.grid {
    display: grid;
    gap: var(--spacing-md);
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

/* Contact Form */
.contact-form {
    margin-top: 3rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 1rem;
    background: var(--color-white-t-05);
    border: 1px solid var(--color-white-t-10);
    border-radius: var(--radius-md);
    color: var(--color-text);
    font-size: 1rem;
    transition: var(--transition-smooth);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary-t-50);
    background: var(--color-white-t-10);
}

.form-group textarea {
    resize: vertical;
}

.contact-form .cta-button {
    align-self: center;
}

.contact-wrapper {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
    margin-top: 3rem;
    align-items: center;
}

@media (min-width: 992px) {
    .contact-wrapper {
        grid-template-columns: 1fr 1fr;
    }
}

/* Footer */
.site-footer {
    background: var(--color-bg);
    padding: 0.5rem;
    text-align: center;
    border-top: 1px solid var(--color-white-t-10);
}

.footer-content {
    position: fixed;
    bottom: 0;
    left: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem;
}

.social-links a {
    color: var(--color-white-t-70);
    text-decoration: none;
    margin: 0 0.5rem;
    transition: color 0.3s ease;
}

.social-links a:hover {
    color: var(--color-primary);
}

@media (min-width: 768px) {
    .footer-content {
        flex-direction: row;
        justify-content: space-between;
    }
}

/* Animations */
@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Scroll Progress */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(
        90deg,
        var(--color-primary),
        var(--color-secondary),
        var(--color-accent)
    );
    transform-origin: left;
    transform: scaleX(0);
    z-index: 1001;
}

/* Navigation */
.nav {
    position: fixed;
    top: 50%;
    right: 2rem;
    transform: translateY(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.nav-dot {
    padding: 0;
    border: none;
    width: 12px;
    height: 12px;
    border-radius: var(--radius-sm);
    background: var(--color-white-t-30);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.nav-dot.active {
    background: var(--color-primary);
    transform: scale(1.3);
}

/* Responsive */
@media (max-width: 768px) {
    .section {
        padding: 3rem 1rem;
    }

    .data-viz {
        grid-template-columns: 1fr;
    }

    .nav {
        display: none;
        top: 1rem;
        right: 1rem;
    }

    .expanded-details {
        grid-template-columns: 1fr;
    }

    .hero h1 {
        font-size: clamp(2.5rem, 10vw, 4rem);
    }

    .hero p {
        font-size: clamp(1rem, 4vw, 1.5rem);
    }

    .section h2 {
        font-size: clamp(2rem, 8vw, 3.5rem);
    }

    .section p {
        font-size: clamp(1rem, 4vw, 1.2rem);
    }

    .contact-form {
        width: 100%;
    }

    .site-footer {
        padding: 2rem 1rem;
    }

    .footer-content {
        position: relative;
        bottom: auto;
        left: auto;
        right: auto;
    }

    .data-card.expanded {
        transform: none;
        margin: 1rem 0;
        min-height: unset;
        width: 100%;
    }

    .carousel-slide {
        padding: 1rem 0.5rem; /* Reduced padding for smaller screens */
        min-height: 300px; /* Adjust min-height for mobile */
    }

    .carousel-slide h3 {
        font-size: 1.2rem; /* Smaller font size for mobile */
    }

    .carousel-slide p {
        font-size: 0.9rem; /* Smaller font size for mobile */
    }

    .chat-container {
        max-width: 100%;
        padding: 0.5rem;
    }

    .chat-message {
        padding: 0.6rem 0.8rem;
    }

    .carousel-arrow {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }

    .carousel-arrow.prev {
        left: 0.5rem;
    }

    .carousel-arrow.next {
        right: 0.5rem;
    }

    .data-card.expanded .data-card-expanded-content {
        max-height: none;
        opacity: 1;
        overflow: visible;
    }

    #contact {
        min-height: auto;
        scroll-snap-align: start;
    }
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 80px;
    right: 20px;
    background: var(--color-white-t-08);
    color: var(--color-text);
    border: 1px solid var(--color-white-t-12);
    border-radius: 50%;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition:
        opacity 0.3s ease-in-out,
        visibility 0.3s ease-in-out,
        background-color 0.3s ease,
        border-color 0.3s ease,
        transform 0.3s ease,
        box-shadow 0.3s ease;
    z-index: 999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px var(--color-primary-t-30);
}

.back-to-top svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

/* Main Header */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 1rem 2rem;
    z-index: 1000;
    display: flex;
    justify-content: space-between; /* Align content to the left and right */
    align-items: center;
    background: transparent; /* Make header background transparent */
}

/* Header Buttons & Click-based Dropdown */
.header-button {
    background: var(--color-white-t-08); /* More subtle background */
    border: 1px solid var(--color-white-t-12); /* Subtle border for definition */
    color: var(--color-text);
    text-decoration: none;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.header-button:hover {
    background: var(--color-primary); /* Use primary color on hover */
    border-color: var(--color-primary); /* Match border to background */
    transform: translateY(-2px);
    box-shadow: 0 6px 16px var(--color-primary-t-30); /* Use theme color for shadow */
}

.header-button svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.dropdown {
    position: relative;
}

.dropdown-menu {
    display: none; /* Hidden by default */
    position: absolute;
    right: 1.5rem;
    top: calc(100% + 12px); /* Position below the button with a gap */
    background-color: var(--color-dropdown-bg); /* Match hover dropdown bg */
    border-radius: var(--radius-md);
    padding: 0.5rem 0;
    min-width: 180px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    border: 1px solid var(--color-white-t-10);
    overflow: hidden;
}

/* This class will be toggled by JS */
.dropdown-menu.show {
    display: block;
    animation: fadeIn 0.2s ease-out; /* Re-use existing animation */
}

.dropdown-menu a {
    color: var(--color-white-t-70);
    padding: 12px 24px;
    text-decoration: none;
    display: block;
    font-size: 16px;
    transition: var(--transition-smooth);
}

.dropdown-menu a:hover {
    background-color: var(--color-primary-t-30);
    color: var(--color-text);
}

.dropdown-item {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    color: var(--color-white-t-70);
    text-decoration: none;
    font-size: 16px;
    transition: var(--transition-smooth);
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.dropdown-item:hover {
    background-color: var(--color-primary-t-30);
    color: var(--color-text);
    transform: translateX(5px);
}

.dropdown-item .theme-icon {
    margin-right: 10px;
    width: 20px;
    height: 20px;
    fill: currentColor;
}
