/**
 * Reset CSS - ComFig
 * 
 * Reset moderne et minimal pour une base propre.
 * Inspiré de modern-normalize et Tailwind preflight.
 * 
 * @author ComFig
 * @version 1.0.0
 */

/* ============================================
   BOX SIZING
   ============================================ */

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

/* ============================================
   RESET MARGES & PADDINGS
   ============================================ */

* {
    margin: 0;
    padding: 0;
}

/* ============================================
   HTML & BODY
   ============================================ */

html {
    /* Smooth scroll */
    scroll-behavior: smooth;
    
    /* Empêcher zoom horizontal sur mobile */
    overflow-x: hidden;
    
    /* Font rendering optimal */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    /* Typo de base */
    font-family: var(--font-body);
    font-size: var(--font-size-base);
    line-height: var(--line-height-normal);
    font-weight: var(--font-weight-normal);
    
    /* Couleurs */
    color: var(--color-blanc);
    background-color: var(--color-noir);
    
    /* Empêcher zoom horizontal */
    overflow-x: hidden;
    
    /* Height min */
    min-height: 100vh;
}

/* ============================================
   TYPOGRAPHIE
   ============================================ */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-tight);
    color: var(--color-blanc);
}

p {
    margin-bottom: var(--space-4);
}

p:last-child {
    margin-bottom: 0;
}

/* Liens */
a {
    color: var(--color-violet);
    text-decoration: none;
    transition: color var(--transition-base);
}

a:hover {
    color: var(--color-violet-light);
}

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

/* ============================================
   IMAGES & MEDIA
   ============================================ */

img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
    height: auto;
}

img {
    /* Éviter les bordures étranges */
    border-style: none;
}

/* ============================================
   FORMULAIRES
   ============================================ */

input,
button,
textarea,
select {
    font: inherit;
    color: inherit;
}

/* Remove default button styles */
button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid var(--color-violet);
    outline-offset: 2px;
}

/* Inputs */
input,
textarea,
select {
    background: var(--bg-secondary);
    border: var(--border-width-thin) solid var(--color-gris-dark);
    border-radius: var(--border-radius-md);
    padding: var(--space-3) var(--space-4);
    width: 100%;
    transition: border-color var(--transition-base);
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--color-violet);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

/* Placeholders */
::placeholder {
    color: var(--color-gris);
    opacity: 0.6;
}

/* ============================================
   TABLES
   ============================================ */

table {
    border-collapse: collapse;
    border-spacing: 0;
    width: 100%;
}

/* ============================================
   CODE & PRE
   ============================================ */

code,
pre {
    font-family: var(--font-mono);
    font-size: 0.9em;
}

code {
    background: rgba(144, 63, 146, 0.1);
    padding: 0.2em 0.4em;
    border-radius: var(--border-radius-sm);
    color: var(--color-violet-light);
}

pre {
    background: var(--bg-secondary);
    padding: var(--space-4);
    border-radius: var(--border-radius-md);
    overflow-x: auto;
}

pre code {
    background: none;
    padding: 0;
}

/* ============================================
   ÉLÉMENTS CACHÉS
   ============================================ */

[hidden] {
    display: none !important;
}

/* ============================================
   SÉLECTION DE TEXTE
   ============================================ */

::selection {
    background-color: var(--color-violet);
    color: var(--color-blanc);
}

::-moz-selection {
    background-color: var(--color-violet);
    color: var(--color-blanc);
}

/* ============================================
   SCROLLBAR (webkit uniquement)
   ============================================ */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--color-gris-dark);
    border-radius: var(--border-radius-sm);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-gris);
}

/* ============================================
   ACCESSIBILITÉ
   ============================================ */

/* Focus visible uniquement au clavier */
:focus:not(:focus-visible) {
    outline: none;
}

:focus-visible {
    outline: 2px solid var(--color-violet);
    outline-offset: 2px;
}

/* Skip link (navigation clavier) */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--color-violet);
    color: var(--color-blanc);
    padding: var(--space-2) var(--space-4);
    text-decoration: none;
    z-index: var(--z-tooltip);
}

.skip-link:focus {
    top: 0;
}

/* 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;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    *,
    *::before,
    *::after {
        background: transparent !important;
        color: #000 !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    a,
    a:visited {
        text-decoration: underline;
    }
    
    img {
        page-break-inside: avoid;
    }
    
    h2,
    h3,
    p {
        orphans: 3;
        widows: 3;
    }
    
    h2,
    h3 {
        page-break-after: avoid;
    }
}
