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

html {
    scroll-behavior: smooth;
}

/* ======== VARIABLES THEME SOMBRE (défaut) ======== */
:root {
    --bg-primary: #0a0e27;
    --bg-secondary: #16213e;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(0, 212, 255, 0.08);
    --text-primary: #e8e8e8;
    --text-secondary: #cbd5e1;
    --text-muted: #a0aec0;
    --accent-primary: #00d4ff;
    --accent-secondary: #0099ff;
    --border-color: rgba(0, 212, 255, 0.15);
    --border-hover: rgba(0, 212, 255, 0.3);
    --shadow-color: rgba(0, 212, 255, 0.15);
    --tooltip-bg: rgba(10, 14, 39, 0.95);
    --particle-color: 0, 212, 255;
}

/* ======== VARIABLES THEME CLAIR ======== */
[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #e2e8f0;
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-card-hover: rgba(0, 136, 204, 0.08);
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --accent-primary: #0088cc;
    --accent-secondary: #0066aa;
    --border-color: rgba(0, 136, 204, 0.2);
    --border-hover: rgba(0, 136, 204, 0.4);
    --shadow-color: rgba(0, 136, 204, 0.15);
    --tooltip-bg: rgba(255, 255, 255, 0.98);
    --particle-color: 0, 136, 204;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background 0.3s ease, color 0.3s ease;
}

#particleCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.5;
    pointer-events: none;
    will-change: auto;
}

.content {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    max-width: 1400px;
    margin: 0 auto;
}

.hero-section {
    text-align: center;
    margin-bottom: 3rem;
}

/* 3D name styling */
.hero-section {
    perspective: 1200px;
}

#name3d {
    display: inline-block;
    transform-style: preserve-3d;
    transition: transform 0.12s ease-out, text-shadow 0.12s ease-out;
    will-change: transform, text-shadow;
    /* subtle extrusion using layered text-shadows */
    text-shadow:
        0 1px 0 rgba(0,0,0,0.12),
        0 2px 0 rgba(0,0,0,0.10),
        0 6px 18px rgba(0,0,0,0.35);
}

#name3d:active {
    transition-duration: 0.06s;
}

h1 {
    font-size: clamp(2rem, 8vw, 3.5rem);
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -1px;
}

h2 {
    font-size: clamp(1rem, 3.5vw, 1.5rem);
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-weight: 500;
    letter-spacing: 1px;
}

.subtitle {
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    color: var(--text-muted);
    margin-top: 0.5rem;
    font-weight: 400;
}

.social-icons {
    display: flex;
    gap: 1rem;
    margin: 2rem 0 3rem 0;
    flex-wrap: wrap;
    justify-content: center;
}

.social-icon {
    padding: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--accent-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
}

.social-icon:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: translateY(-4px);
    box-shadow: 0 8px 16px var(--shadow-color);
}

.social-icon::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: -2.5rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.4rem 0.8rem;
    background-color: var(--tooltip-bg);
    color: var(--accent-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    font-weight: 500;
}

.social-icon:hover::after {
    opacity: 1;
    visibility: visible;
    bottom: -2.2rem;
}

.sections-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    width: 100%;
    max-width: 1000px;
    padding: 0 1rem;
    margin: 0 auto;
}

.section-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    min-height: 240px;
    position: relative;
    overflow: hidden;
    will-change: transform, box-shadow;
}

.section-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(var(--particle-color), 0.1), transparent);
    transition: left 0.5s ease;
}

.section-card:hover::before {
    left: 100%;
}

.section-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: translateY(-8px);
    box-shadow: 0 12px 24px var(--shadow-color);
}

.card-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    flex: 1;
    position: relative;
    z-index: 1;
}

.card-content svg {
    color: var(--accent-primary);
    transition: transform 0.3s ease;
}

.section-card:hover .card-content svg {
    transform: scale(1.1);
}

.section-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.section-card p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.6;
}

.card-arrow {
    position: relative;
    z-index: 1;
    margin-top: auto;
}

.card-arrow svg {
    color: var(--accent-primary);
    transition: all 0.3s ease;
    opacity: 0.6;
}

.section-card:hover .card-arrow svg {
    opacity: 1;
    transform: translateX(4px);
}

/* ======== RESPONSIVE DESIGN ======== */
@media (max-width: 768px) {
    .content {
        padding: 1.5rem 1rem;
    }

    .hero-section {
        margin-bottom: 2rem;
    }

    h1 {
        font-size: clamp(1.8rem, 6vw, 2.5rem);
    }

    h2 {
        font-size: clamp(0.95rem, 2.5vw, 1.25rem);
    }

    .subtitle {
        font-size: clamp(0.85rem, 1.8vw, 1rem);
    }

    .social-icons {
        gap: 0.75rem;
        margin: 1.5rem 0 2rem 0;
    }

    .social-icon {
        padding: 0.6rem;
    }

    .social-icon::after {
        bottom: -2.2rem;
        font-size: 0.7rem;
        padding: 0.3rem 0.6rem;
    }

    .sections-container {
        gap: 1rem;
        padding: 0 0.5rem;
    }

    .section-card {
        padding: 1.5rem;
        min-height: 220px;
    }

    .section-card h3 {
        font-size: 1.1rem;
    }

    .section-card p {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .content {
        padding: 1rem 0.75rem;
    }

    h1 {
        font-size: clamp(1.5rem, 5vw, 2rem);
        letter-spacing: -0.5px;
    }

    h2 {
        font-size: clamp(0.9rem, 2vw, 1rem);
    }

    .subtitle {
        font-size: clamp(0.8rem, 1.5vw, 0.9rem);
    }

    .hero-section {
        margin-bottom: 1.5rem;
    }

    .social-icons {
        gap: 0.6rem;
        margin: 1rem 0 1.5rem 0;
    }

    .social-icon {
        padding: 0.5rem;
        width: 40px;
        height: 40px;
    }

    .social-icon svg {
        width: 18px;
        height: 18px;
    }

    .social-icon::after {
        display: none;
    }

    .sections-container {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 0 0.5rem;
        max-width: 100%;
    }

    .section-card {
        padding: 1.25rem;
        min-height: 200px;
    }

    .section-card h3 {
        font-size: 1rem;
    }

    .section-card p {
        font-size: 0.85rem;
    }
}

/* ======== THEME TOGGLE BUTTON ======== */
.theme-toggle {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 1000;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.theme-toggle:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: scale(1.1);
    box-shadow: 0 6px 16px var(--shadow-color);
}

.theme-toggle svg {
    width: 24px;
    height: 24px;
    color: var(--accent-primary);
    transition: transform 0.3s ease;
}

.theme-toggle:hover svg {
    transform: rotate(15deg);
}

.theme-toggle .sun-icon {
    display: none;
}

.theme-toggle .moon-icon {
    display: block;
}

[data-theme="light"] .theme-toggle .sun-icon {
    display: block;
}

[data-theme="light"] .theme-toggle .moon-icon {
    display: none;
}

/* Light theme specific adjustments */
[data-theme="light"] .section-card {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .social-icon {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

@media (max-width: 480px) {
    .theme-toggle {
        width: 42px;
        height: 42px;
        top: 1rem;
        right: 1rem;
    }

    .theme-toggle svg {
        width: 20px;
        height: 20px;
    }
}