/* ========================================= */
/* ARTISAN DU WEB - RÉALISATIONS */
/* Design élégant, professionnel et intemporel */
/* VERSION ULTRA-OPTIMISÉE RESPONSIVE */
/* ========================================= */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700;800&family=Lato:wght@300;400;600;700&display=swap');

/* ========================================= */
/* 1. VARIABLES CSS */
/* ========================================= */

:root {
    --color-primary: #2C3E50;
    --color-secondary: #34495E;
    --color-accent: #D4AF37;
    --color-accent-light: #E8C468;
    --color-background: #FAF9F6;
    --color-card: #FFFFFF;
    --color-text: #2C3E50;
    --color-text-light: #6C7A89;
    --color-border: #E5E5E5;
    
    --font-heading: 'Playfair Display', Georgia, serif;
    --font-body: 'Lato', 'Helvetica Neue', sans-serif;
    
    /* Espacements fluides avec clamp */
    --spacing-xs: clamp(0.4rem, 1vw, 0.5rem);
    --spacing-sm: clamp(0.75rem, 2vw, 1rem);
    --spacing-md: clamp(1rem, 3vw, 1.5rem);
    --spacing-lg: clamp(1.5rem, 4vw, 2.5rem);
    --spacing-xl: clamp(2rem, 6vw, 4rem);
    
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    
    --shadow-sm: 0 2px 8px rgba(44, 62, 80, 0.08);
    --shadow-md: 0 4px 16px rgba(44, 62, 80, 0.12);
    --shadow-lg: 0 8px 32px rgba(44, 62, 80, 0.16);
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Touch targets minimum 44px */
    --touch-target: 44px;
}

/* ========================================= */
/* 2. RESET ET BASE */
/* ========================================= */

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

body {
    font-family: var(--font-body);
    background: var(--color-background);
    color: var(--color-text);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: clamp(15px, 1.5vw, 16px);
}

/* ========================================= */
/* 3. CONTENEUR PRINCIPAL */
/* ========================================= */

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--spacing-xl) clamp(3%, 5vw, 5%);
}

/* ========================================= */
/* 4. HEADER - RESPONSIVE */
/* ========================================= */

.header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
    position: relative;
}

.title {
    font-size: clamp(2rem, 5vw + 0.5rem, 4rem);
    font-weight: 700;
    font-family: var(--font-heading);
    color: var(--color-primary);
    margin-bottom: var(--spacing-md);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.subtitle {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: var(--color-text-light);
    font-weight: 400;
    line-height: 1.5;
}

/* ========================================= */
/* 5. FILTRES - RESPONSIVE */
/* ========================================= */

.filters {
    display: flex;
    justify-content: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-xl);
    flex-wrap: wrap;
    padding: 0 var(--spacing-sm);
}

.filter-btn {
    padding: clamp(0.6rem, 2vw, 0.75rem) clamp(1rem, 3vw, 1.5rem);
    background: var(--color-card);
    color: var(--color-text);
    border: 2px solid var(--color-border);
    border-radius: 50px;
    cursor: pointer;
    font-size: clamp(0.85rem, 1.5vw, 0.95rem);
    font-weight: 600;
    font-family: var(--font-body);
    transition: var(--transition);
    min-height: var(--touch-target);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

@media (hover: hover) {
    .filter-btn:hover {
        border-color: var(--color-accent);
        transform: translateY(-2px);
        box-shadow: var(--shadow-sm);
    }
}

.filter-btn:active {
    transform: translateY(0);
}

.filter-btn.active {
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-light) 100%);
    color: white;
    border-color: transparent;
    box-shadow: var(--shadow-md);
}

/* ========================================= */
/* 6. GRILLE DE PROJETS - ULTRA-RESPONSIVE */
/* ========================================= */

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr));
    gap: var(--spacing-lg);
}

/* Tablettes */
@media (max-width: 1024px) and (min-width: 769px) {
    .projects-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    }
}

/* Mobiles */
@media (max-width: 768px) {
    .projects-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }
}

/* ========================================= */
/* 7. CARTES DE PROJETS - OPTIMISÉES */
/* ========================================= */

.project-card {
    background: var(--color-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 2px solid var(--color-border);
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    position: relative;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--color-accent), var(--color-accent-light));
    transform: scaleX(0);
    transform-origin: left;
    transition: var(--transition);
    z-index: 1;
}

/* Hover uniquement sur devices avec hover */
@media (hover: hover) {
    .project-card:hover::before {
        transform: scaleX(1);
    }

    .project-card:hover {
        transform: translateY(-8px);
        border-color: var(--color-accent);
        box-shadow: var(--shadow-lg);
    }
}

/* Active state pour mobile */
.project-card:active {
    transform: translateY(-4px);
}

/* ========================================= */
/* 8. IMAGE DU PROJET - RESPONSIVE */
/* ========================================= */

.project-image {
    height: clamp(200px, 40vw, 240px);
    background: linear-gradient(135deg, #F5F5F5 0%, #E8E8E8 100%);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

/* Placeholder pour projets sans image */
.placeholder-img {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-light);
    opacity: 0.4;
}

/* ========================================= */
/* 9. CONTENU DU PROJET - RESPONSIVE */
/* ========================================= */

.project-content {
    padding: var(--spacing-lg);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.project-tag {
    display: inline-block;
    padding: clamp(0.3rem, 1vw, 0.4rem) clamp(0.8rem, 2vw, 1rem);
    background: rgba(212, 175, 55, 0.15);
    color: var(--color-accent);
    border-radius: 50px;
    font-size: clamp(0.7rem, 1.5vw, 0.8rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--spacing-sm);
    border: 1px solid var(--color-accent);
    width: fit-content;
}

.project-title {
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    font-weight: 700;
    font-family: var(--font-heading);
    margin-bottom: var(--spacing-sm);
    color: var(--color-primary);
    letter-spacing: -0.01em;
    line-height: 1.3;
}

.project-description {
    color: var(--color-text-light);
    margin-bottom: var(--spacing-md);
    font-size: clamp(0.9rem, 1.5vw, 1rem);
    line-height: 1.7;
}

/* ========================================= */
/* 10. INFORMATIONS DU PROJET - OPTIMISÉES */
/* ========================================= */

.project-info {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.info-item {
    font-size: clamp(0.85rem, 1.5vw, 0.9rem);
    color: var(--color-text);
    padding: var(--spacing-xs) var(--spacing-sm);
    background: rgba(44, 62, 80, 0.03);
    border-left: 3px solid var(--color-accent);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    line-height: 1.6;
}

@media (hover: hover) {
    .info-item:hover {
        background: rgba(212, 175, 55, 0.1);
        transform: translateX(3px);
    }
}

.info-item strong {
    color: var(--color-primary);
    font-weight: 700;
    margin-right: var(--spacing-xs);
    display: inline-block;
}

/* ========================================= */
/* 11. URL DU PROJET - TOUCH-FRIENDLY */
/* ========================================= */

.project-url {
    margin-top: auto;
    padding-top: var(--spacing-md);
    border-top: 2px solid var(--color-border);
}

.url-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    padding: clamp(0.6rem, 2vw, 0.75rem) clamp(1rem, 3vw, 1.5rem);
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-light) 100%);
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-family: var(--font-body);
    border-radius: 50px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    font-size: clamp(0.85rem, 1.5vw, 0.95rem);
    letter-spacing: 0.3px;
    min-height: var(--touch-target);
    width: 100%;
}

@media (min-width: 769px) {
    .url-link {
        width: auto;
    }
}

@media (hover: hover) {
    .url-link:hover {
        transform: translateY(-3px);
        box-shadow: var(--shadow-md);
        background: linear-gradient(135deg, var(--color-accent-light) 0%, var(--color-accent) 100%);
    }
}

.url-link:active {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.url-link i {
    font-size: clamp(0.9rem, 1.5vw, 1rem);
    transition: transform 0.3s ease;
}

@media (hover: hover) {
    .url-link:hover i {
        transform: translateX(3px);
    }
}

/* ========================================= */
/* 12. PROJETS À VENIR */
/* ========================================= */

.coming-soon {
    opacity: 0.7;
}

.coming-soon .project-tag {
    background: rgba(108, 122, 137, 0.15);
    color: var(--color-text-light);
    border-color: var(--color-text-light);
}

.coming-soon .project-image {
    background: linear-gradient(135deg, #E8E8E8 0%, #D5D5D5 100%);
}

/* ========================================= */
/* 13. BOUTON RETOUR - TOUCH-OPTIMIZED */
/* ========================================= */

.back-button-fixed {
    position: fixed;
    top: clamp(15px, 3vw, 30px);
    left: clamp(15px, 3vw, 30px);
    z-index: 1000;
}

.back-button-fixed .back-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: clamp(45px, 10vw, 55px);
    height: clamp(45px, 10vw, 55px);
    min-width: var(--touch-target);
    min-height: var(--touch-target);
    font-size: clamp(1.5rem, 4vw, 2rem);
    color: var(--color-primary);
    background: white;
    border: 2px solid var(--color-border);
    border-radius: 50%;
    text-decoration: none;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

@media (hover: hover) {
    .back-button-fixed .back-link:hover {
        background: var(--color-accent);
        color: white;
        border-color: var(--color-accent);
        transform: translateY(-4px);
        box-shadow: var(--shadow-lg);
    }
}

.back-button-fixed .back-link:active {
    transform: translateY(-2px);
}

/* ========================================= */
/* 14. FOOTER - COMPLÉTÉ */
/* ========================================= */

.site-footer {
    text-align: center;
    padding: var(--spacing-xl) var(--spacing-lg);
    color: var(--color-text-light);
    margin-top: var(--spacing-xl);
    border-top: 1px solid var(--color-border);
}

.site-footer p {
    margin: 0;
    font-size: clamp(0.85rem, 1.5vw, 0.95rem);
    line-height: 1.6;
}

/* ========================================= */
/* 15. RESPONSIVE - BREAKPOINTS DÉTAILLÉS */
/* ========================================= */

/* Grands écrans */
@media (min-width: 1400px) {
    .projects-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Tablettes larges */
@media (max-width: 1024px) and (min-width: 769px) {
    .container {
        padding: var(--spacing-lg) clamp(20px, 4vw, 40px);
    }
}

/* Tablettes en portrait */
@media (max-width: 768px) {
    .container {
        padding: var(--spacing-lg) var(--spacing-md);
    }
    
    .project-content {
        padding: var(--spacing-md);
    }
    
    .header {
        margin-bottom: var(--spacing-lg);
    }
}

/* Mobiles */
@media (max-width: 480px) {
    .container {
        padding: var(--spacing-md) var(--spacing-sm);
    }
    
    .project-content {
        padding: var(--spacing-sm);
    }
    
    body {
        font-size: 14px;
    }
}

/* Très petits écrans */
@media (max-width: 360px) {
    .container {
        padding: var(--spacing-sm) 10px;
    }
    
    .project-image {
        height: 180px;
    }
}

/* ========================================= */
/* 16. ANIMATIONS - OPTIMISÉES MOBILE */
/* ========================================= */

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

/* Animations uniquement sur desktop pour performances */
@media (min-width: 769px) and (prefers-reduced-motion: no-preference) {
    .header,
    .project-card {
        animation: fadeInUp 0.6s ease-out backwards;
    }
    
    .project-card:nth-child(1) { animation-delay: 0.1s; }
    .project-card:nth-child(2) { animation-delay: 0.15s; }
    .project-card:nth-child(3) { animation-delay: 0.2s; }
    .project-card:nth-child(4) { animation-delay: 0.25s; }
    .project-card:nth-child(5) { animation-delay: 0.3s; }
    .project-card:nth-child(6) { animation-delay: 0.35s; }
}

/* ========================================= */
/* 17. ACCESSIBILITÉ */
/* ========================================= */

/* Respect des préférences utilisateur */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible pour navigation clavier */
a:focus-visible,
button:focus-visible,
.filter-btn:focus-visible,
.url-link:focus-visible,
.back-button-fixed .back-link:focus-visible {
    outline: 3px solid var(--color-accent);
    outline-offset: 4px;
}

/* Sélection de texte */
::selection {
    background: var(--color-accent-light);
    color: white;
}

/* Scrollbar personnalisée (desktop uniquement) */
@media (min-width: 769px) {
    ::-webkit-scrollbar {
        width: 10px;
    }
    
    ::-webkit-scrollbar-track {
        background: var(--color-background);
    }
    
    ::-webkit-scrollbar-thumb {
        background: var(--color-accent);
        border-radius: 5px;
    }
    
    ::-webkit-scrollbar-thumb:hover {
        background: var(--color-accent-light);
    }
}

/* ========================================= */
/* 18. OPTIMISATIONS MOBILES */
/* ========================================= */

/* Amélioration du tap/scroll sur mobile */
@media (max-width: 768px) {
    body {
        -webkit-tap-highlight-color: rgba(212, 175, 55, 0.2);
    }
    
    /* Éviter le zoom sur input sur iOS */
    input, select, textarea {
        font-size: 16px;
    }
}

/* Orientation paysage mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .project-image {
        height: 160px;
    }
    
    .container {
        padding: var(--spacing-md) var(--spacing-sm);
    }
}
