/**
 * ================================================================
 * AMÉLIORATIONS VISUELLES AVANCÉES - JEAN-DAVID WAEBER PORTFOLIO
 * Hero visuel cohérent + Scroll naturel et fluide
 * ================================================================
 */

/* === HERO MODERNE PROFESSIONNEL === */

/* Hero moderne avec layout grid */
.hero-modern {
    min-height: 100vh;
    padding: var(--space-4xl) 0;
    background: var(--color-background);
    display: flex;
    align-items: center;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4xl);
    align-items: center;
}

/* Section texte */
.hero-text {
    max-width: 600px;
}

.hero-badge {
    display: inline-block;
    padding: var(--space-sm) var(--space-lg);
    background: var(--color-accent-alpha);
    color: var(--color-accent-base);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    margin-bottom: var(--space-lg);
    border: 1px solid rgba(201, 166, 70, 0.2);
}

.hero-title {
    font-family: var(--font-serif);
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: var(--weight-bold);
    color: var(--color-text-primary);
    margin-bottom: var(--space-lg);
    line-height: var(--leading-tight);
}

.hero-subtitle {
    display: block;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    font-weight: var(--weight-normal);
    color: var(--color-accent-base);
    margin-top: var(--space-sm);
}

.hero-description {
    font-size: var(--text-lg);
    color: var(--color-text-secondary);
    line-height: var(--leading-relaxed);
    margin-bottom: var(--space-xl);
}

.hero-actions {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
}

/* Galerie hero moderne */
.hero-gallery {
    position: relative;
}

.gallery-main {
    position: relative;
    margin-bottom: var(--space-lg);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-2xl);
}

.gallery-featured {
    width: 100%;
    height: 400px;
    object-fit: cover;
    transition: transform var(--duration-slow) var(--ease-out);
}

.gallery-featured:hover {
    transform: scale(1.05);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-md);
}

.gallery-item {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-out);
    opacity: 0.7;
    border: 2px solid transparent;
}

.gallery-item:hover {
    opacity: 1;
    transform: translateY(-4px);
    border-color: var(--color-accent-base);
    box-shadow: var(--shadow-lg);
}

/* Page-header existant conservé */
.page-header {
    min-height: 60vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--color-background);
    background: linear-gradient(
        180deg,
        var(--color-primary-darkest) 0%,
        var(--color-primary-darkest) 70%,
        rgba(11, 14, 18, 0.95) 90%,
        rgba(11, 14, 18, 0.9) 100%
    );
}

/* Images de fond pour page-header uniquement */
.page-header-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -2;
    will-change: transform;
}

.page-header-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        135deg,
        rgba(11, 14, 18, 0.5) 0%,
        rgba(11, 14, 18, 0.4) 50%,
        rgba(11, 14, 18, 0.6) 100%
    );
    z-index: -1;
}

/* Amélioration du contenu page-header */
.page-header-content {
    text-align: center;
    padding: var(--space-2xl);
    max-width: var(--container-md);
    z-index: 1;
    position: relative;
}

/* Indication subtile de scroll */
.page-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        var(--color-surface-elevated) 100%
    );
    z-index: 1;
    pointer-events: none;
}

/* Responsive hero moderne */
@media (max-width: 1024px) {
    .hero-grid {
        grid-template-columns: 1fr;
        gap: var(--space-2xl);
        text-align: center;
    }
    
    .hero-text {
        order: 2;
    }
    
    .hero-gallery {
        order: 1;
        max-width: 500px;
        margin: 0 auto;
    }
}

@media (max-width: 768px) {
    .hero-modern {
        min-height: 90vh;
        padding: var(--space-2xl) 0;
    }
    
    .hero-actions {
        flex-direction: column;
        align-items: center;
    }

    .btn-lg {
        width: 100%;
        max-width: 300px;
    }
    
    .gallery-featured {
        height: 300px;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-sm);
    }
    
    .gallery-item {
        height: 60px;
    }
}

/* === SYSTÈME DE SCROLL FLUIDE === */

/* Animations musicales fluides */
.fade-up-element {
    opacity: 0;
    transform: translateY(60px);
    transition: all var(--duration-slow) var(--ease-out);
    will-change: opacity, transform;
}

.fade-up-element.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* Animation spéciale pour le hero */
.hero-modern .fade-up-element {
    opacity: 1;
    transform: translateY(0);
}

/* Effet crescendo pour les éléments */
.fade-in {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: opacity, transform;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Orchestration des entrées */
.fade-up-stagger {
    transition-delay: 0ms;
}

.fade-up-stagger:nth-child(2) { transition-delay: 150ms; }
.fade-up-stagger:nth-child(3) { transition-delay: 300ms; }
.fade-up-stagger:nth-child(4) { transition-delay: 450ms; }
.fade-up-stagger:nth-child(5) { transition-delay: 600ms; }
.fade-up-stagger:nth-child(6) { transition-delay: 750ms; }

/* Effet parallax subtil */
.parallax-element {
    transform: translateZ(0);
    will-change: transform;
}

/* Respiration entre sections */
.section + .section {
    margin-top: var(--space-2xl);
}

.section-header {
    margin-bottom: var(--space-4xl);
    opacity: 0;
    transform: translateY(40px);
    transition: all 1s cubic-bezier(0.23, 1, 0.32, 1);
}

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

/* === SCROLL MUSICAL FLUIDE === */

/* Transition douce hero vers contenu */
.hero-modern::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(16, 20, 25, 0.1) 20%,
        rgba(16, 20, 25, 0.3) 50%,
        rgba(16, 20, 25, 0.8) 90%,
        var(--color-surface-elevated) 100%
    );
    pointer-events: none;
    z-index: 1;
}

/* Sections avec transitions harmonieuses */
.section {
    background: var(--color-surface-elevated);
    position: relative;
    z-index: 2;
    padding: var(--space-6xl) 0;
    transition: all var(--duration-slow) var(--ease-out);
}

.section:first-of-type {
    padding-top: var(--space-4xl);
    /* Respiration naturelle après le hero */
}

.section-alt {
    background: var(--color-surface);
}

/* Effet de profondeur subtil */
.section:nth-child(even) {
    background: var(--color-surface);
}

.section:nth-child(odd) {
    background: var(--color-surface-elevated);
}

/* === GALERIE : RATIO UNIFORME + HOVER EFFECTS === */

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-lg);
    padding: var(--space-xl) 0;
}

.gallery-item {
    position: relative;
    aspect-ratio: 1; /* Ratio carré uniforme */
    overflow: hidden;
    border-radius: var(--radius-xl);
    background: var(--color-surface);
    cursor: pointer;
    transition: all var(--duration-slow) var(--ease-out);
    will-change: transform, box-shadow;
}

.gallery-item:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-2xl);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--duration-slower) var(--ease-out);
    will-change: transform;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

.gallery-item-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        0deg,
        rgba(11, 14, 18, 0.7) 0%,
        transparent 40%,
        transparent 60%,
        rgba(11, 14, 18, 0.3) 100%
    );
    opacity: 0;
    transition: opacity var(--duration-normal) var(--ease-out);
}

.gallery-item:hover .gallery-item-overlay {
    opacity: 1;
}

.gallery-item-content {
    position: absolute;
    bottom: var(--space-lg);
    left: var(--space-lg);
    right: var(--space-lg);
    color: var(--color-text-primary);
    transform: translateY(20px);
    opacity: 0;
    transition: all var(--duration-normal) var(--ease-out);
}

.gallery-item:hover .gallery-item-content {
    transform: translateY(0);
    opacity: 1;
}

.gallery-item-title {
    font-family: var(--font-serif);
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    margin-bottom: var(--space-xs);
}

.gallery-item-description {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    line-height: var(--leading-relaxed);
}

/* Première ligne visible au-dessus du fold */
.gallery-preview {
    margin-bottom: var(--space-2xl);
}

.gallery-preview .gallery-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    max-height: 400px;
    overflow: hidden;
    mask-image: linear-gradient(
        to bottom,
        black 0%,
        black 70%,
        transparent 100%
    );
}

/* === SECTIONS AVEC CONTRASTE AMÉLIORÉ === */

.section-header {
    text-align: center;
    margin-bottom: var(--space-3xl);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid rgba(201, 166, 70, 0.2);
}

.section-title {
    font-size: var(--text-3xl);
    font-weight: var(--weight-semibold);
    margin-bottom: var(--space-md);
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -var(--space-sm);
    left: 50%;
    transform: translateX(-50%);
    width: var(--space-2xl);
    height: 3px;
    background: var(--gradient-accent);
    border-radius: var(--radius-full);
}

/* === CARDS AMÉLIORÉES === */

.card {
    background: var(--color-surface-elevated);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    border: 1px solid rgba(201, 166, 70, 0.1);
    transition: all var(--duration-slow) var(--ease-out);
    position: relative;
    overflow: hidden;
    will-change: transform, box-shadow;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-accent);
    transform: scaleX(0);
    transition: transform var(--duration-normal) var(--ease-out);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: rgba(201, 166, 70, 0.3);
}

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

/* === RESPONSIVE AMÉLIORATIONS === */

@media (max-width: 768px) {
    .hero,
    .page-header {
        min-height: 100vh;
        padding: var(--space-xl) var(--space-md);
    }
    
    .hero-content,
    .page-header-content {
        padding: var(--space-xl);
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: var(--space-md);
    }
    
    .section {
        padding: var(--space-3xl) 0;
        margin-top: -20px;
    }
    
    .fade-up-element {
        transform: translateY(20px);
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-sm);
    }
    
    .gallery-item {
        aspect-ratio: 0.8; /* Ratio portrait pour mobile */
    }
}

/* === ACCESSIBILITÉ ET PERFORMANCE === */

/* Respecter prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    .fade-up-element,
    .gallery-item,
    .gallery-item img,
    .gallery-item-overlay,
    .gallery-item-content,
    .card,
    .card::before {
        transition: none !important;
        animation: none !important;
        transform: none !important;
    }
    
    .fade-up-element {
        opacity: 1;
    }
    
    .hero::after,
    .page-header::after {
        display: none;
    }
}

/* Focus management pour accessibilité */
.gallery-item:focus {
    outline: 3px solid var(--color-accent-base);
    outline-offset: 2px;
}

.gallery-item:focus:not(:hover) {
    transform: none;
}

/* Optimisation performance */
.gallery-item,
.fade-up-element,
.card {
    contain: layout style paint;
}

/* Loading states */
.gallery-item img[loading="lazy"] {
    background: var(--color-surface);
}

.gallery-item img:not([src]) {
    background: linear-gradient(
        45deg,
        var(--color-surface) 25%,
        transparent 25%,
        transparent 75%,
        var(--color-surface) 75%
    );
    background-size: 20px 20px;
    animation: shimmer 1.5s infinite linear;
}

@keyframes shimmer {
    0% {
        background-position: -20px 0;
    }
    100% {
        background-position: 20px 0;
    }
}