/**
 * GLOBAL STYLES - Le Chemin Du Prince
 * Styles de base et reset CSS pour tous les sous-domaines
 *
 * IMPORTANT: Ce fichier doit être chargé APRÈS variables.css
 */

/* ============================================
   CSS RESET
   ============================================ */

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

html {
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html, body {
    height: 100%;
    scroll-behavior: smooth;
}

body {
    background-color: var(--cream-color);
    color: var(--dark-text);
    font-family: var(--font-primary);
    font-size: var(--text-md);
    line-height: var(--leading-normal);
    position: relative;
    cursor: default;
    overflow-x: hidden;
}

/* ============================================
   TEXTURE D'ARRIÈRE-PLAN (optionnelle)
   ============================================ */
body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMDAiIGhlaWdodD0iMzAwIj48ZmlsdGVyIGlkPSJhIiB4PSIwIiB5PSIwIj48ZmVUdXJidWxlbmNlIGJhc2VGcmVxdWVuY3k9Ii43NSIgc3RpdGNoVGlsZXM9InN0aXRjaCIgdHlwZT0iZnJhY3RhbE5vaXNlIi8+PGZlQ29sb3JNYXRyaXggdHlwZT0ic2F0dXJhdGUiIHZhbHVlcz0iMCIvPjwvZmlsdGVyPjxwYXRoIGQ9Ik0wIDBoMzAwdjMwMEgweiIgZmlsdGVyPSJ1cmwoI2EpIiBvcGFjaXR5PSIuMDUiLz48L3N2Zz4=');
    pointer-events: none;
    z-index: var(--z-base);
    opacity: 0.2;
}

/* ============================================
   ÉLÉMENTS DE BASE
   ============================================ */

/* Liens */
a {
    text-decoration: none;
    color: inherit;
    transition: opacity var(--duration-fast) var(--transition-smooth);
}

a:hover {
    opacity: 0.8;
}

a:focus-visible {
    outline: 2px solid var(--dark-text);
    outline-offset: 2px;
    border-radius: var(--radius-xs);
}

/* Images */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Boutons */
button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    padding: 0;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

button:focus-visible {
    outline: 2px solid var(--dark-text);
    outline-offset: 2px;
}

/* Inputs */
input, textarea, select {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    border: none;
    background: none;
}

input:focus, textarea:focus, select:focus {
    outline: none;
}

/* Listes */
ul, ol {
    list-style: none;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
    font-weight: var(--font-normal);
    line-height: var(--leading-tight);
}

/* Screen reader only */
.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;
}

/* ============================================
   LAYOUT COMMUNS
   ============================================ */

.scroll-container {
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: auto;  /* Lenis handles smooth scrolling */
}

.main-content {
    position: relative;
    min-height: 100vh;
    width: 100%;
    padding-top: 5rem; /* Espace pour le header fixe */
    z-index: var(--z-base);
}

.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

/* Container variants */
.container-sm {
    max-width: var(--container-sm);
}

.container-md {
    max-width: var(--container-md);
}

.container-lg {
    max-width: var(--container-lg);
}

.container-xl {
    max-width: var(--container-xl);
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Display */
.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

/* Flexbox */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

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

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

/* Grid */
.grid {
    display: grid;
}

/* Spacing */
.gap-xs { gap: var(--spacing-xs); }
.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }
.gap-xl { gap: var(--spacing-xl); }

/* Text alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Font weights */
.font-light { font-weight: var(--font-light); }
.font-normal { font-weight: var(--font-normal); }
.font-medium { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }
.font-bold { font-weight: var(--font-bold); }

/* Text transform */
.uppercase { text-transform: uppercase; }
.lowercase { text-transform: lowercase; }
.capitalize { text-transform: capitalize; }

/* ============================================
   DÉSACTIVER LE SCROLL (pour modals)
   ============================================ */
.no-scroll {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* ============================================
   CURSEUR PERSONNALISÉ (optionnel)
   ============================================ */
.cursor {
    position: fixed;
    pointer-events: none;
    z-index: var(--z-max);
    mix-blend-mode: difference;
}

.cursor-dot {
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    position: absolute;
    transform: translate(-50%, -50%);
    transition: transform 0.1s ease;
}

.cursor-outline {
    width: 40px;
    height: 40px;
    border: 2px solid white;
    border-radius: 50%;
    position: absolute;
    transform: translate(-50%, -50%);
    transition: all 0.15s ease;
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    body::after {
        display: none;
    }

    .header,
    .nav-panel,
    .cart-panel,
    .accessibility-overlay,
    .cursor {
        display: none !important;
    }

    .main-content {
        padding-top: 0;
    }

    a {
        text-decoration: underline;
    }
}

/* ============================================
   PRÉFÉRENCES D'ACCESSIBILITÉ
   ============================================ */

/* Réduire les animations si demandé */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Augmenter le contraste si demandé */
@media (prefers-contrast: high) {
    :root {
        --frost-bg: rgba(249, 249, 249, 0.95);
        --frost-bg-dark: rgba(0, 0, 0, 0.95);
    }

    body::after {
        opacity: 0;
    }
}

/* Mode sombre système */
@media (prefers-color-scheme: dark) {
    body {
        background-color: var(--cream-color);
        color: var(--dark-text);
    }
    /* Note: Le mode sombre n'est pas appliqué par défaut,
       seulement si l'utilisateur le choisit via le menu accessibilité */
}

/* ============================================
   FOCUS VISIBLE AMÉLIORÉ
   ============================================ */
:focus-visible {
    outline: 2px solid var(--dark-text);
    outline-offset: 2px;
    border-radius: var(--radius-xs);
}

/* ============================================
   CLASSES POUR MENU ACCESSIBILITÉ
   ============================================ */

/* Inversion des images */
body.invert-images img {
    filter: invert(1);
}

/* Mode monochrome */
body.monochrome {
    filter: grayscale(100%);
}

body.monochrome img {
    filter: grayscale(100%);
}

/* Réduction des animations */
body.reduce-motion * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
}

/* Mode haut contraste */
body.high-contrast {
    --frost-bg: rgba(255, 255, 255, 0.98);
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.3);
}

body.high-contrast::after {
    opacity: 0;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

/* Tablet */
@media (max-width: 1024px) {
    .main-content {
        padding-top: 4.5rem;
    }

    .container {
        padding: 0 var(--spacing-md);
    }
}

/* Mobile */
@media (max-width: 768px) {
    body {
        font-size: var(--text-base);
    }

    .main-content {
        padding-top: 4rem;
    }

    .container {
        padding: 0 var(--spacing-sm);
    }
}

/* Small mobile */
@media (max-width: 480px) {
    .main-content {
        padding-top: 3.5rem;
    }

    .container {
        padding: 0 var(--spacing-xs);
    }
}
