/**
 * TXL Gen4 Design System - Reset & Base Styles
 * 
 * Reset moderne et styles de base
 */

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

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

/* ============================================
   DOCUMENT
   ============================================ */

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-family-sans);
    font-size: var(--font-size-base);
    line-height: var(--line-height-normal);
    color: var(--color-text-primary);
    background-color: var(--color-background);
    min-height: 100vh;
}

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

h1, h2, h3, h4, h5, h6 {
    margin: 0 0 var(--spacing-4) 0;
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-tight);
    color: var(--color-text-primary);
}

h1 { font-size: var(--font-size-4xl); }
h2 { font-size: var(--font-size-3xl); }
h3 { font-size: var(--font-size-2xl); }
h4 { font-size: var(--font-size-xl); }
h5 { font-size: var(--font-size-lg); }
h6 { font-size: var(--font-size-base); }

p {
    margin: 0 0 var(--spacing-4) 0;
}

a {
    color: var(--color-link);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-link-hover);
    text-decoration: underline;
}

a:visited {
    color: var(--color-link-visited);
}

small {
    font-size: var(--font-size-sm);
}

strong, b {
    font-weight: var(--font-weight-bold);
}

em, i {
    font-style: italic;
}

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

code {
    padding: var(--spacing-1) var(--spacing-2);
    background-color: var(--color-neutral-100);
    border-radius: var(--radius-base);
    color: var(--color-error-700);
}

pre {
    padding: var(--spacing-4);
    background-color: var(--color-neutral-100);
    border-radius: var(--radius-md);
    overflow-x: auto;
}

pre code {
    padding: 0;
    background-color: transparent;
    color: inherit;
}

blockquote {
    margin: var(--spacing-6) 0;
    padding-left: var(--spacing-6);
    border-left: 4px solid var(--color-primary-500);
    font-style: italic;
    color: var(--color-text-secondary);
}

/* ============================================
   LISTES
   ============================================ */

ul, ol {
    margin: 0 0 var(--spacing-4) 0;
    padding-left: var(--spacing-6);
}

li {
    margin-bottom: var(--spacing-2);
}

ul ul, ol ul, ul ol, ol ol {
    margin-bottom: 0;
}

dl {
    margin: 0 0 var(--spacing-4) 0;
}

dt {
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--spacing-1);
}

dd {
    margin-left: 0;
    margin-bottom: var(--spacing-4);
}

/* ============================================
   IMAGES & MÉDIAS
   ============================================ */

img, svg, video, canvas, audio, iframe, embed, object {
    display: block;
    max-width: 100%;
    height: auto;
}

figure {
    margin: 0 0 var(--spacing-6) 0;
}

figcaption {
    margin-top: var(--spacing-2);
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    text-align: center;
}

/* ============================================
   TABLEAUX
   ============================================ */

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: var(--spacing-6);
}

th, td {
    padding: var(--spacing-3) var(--spacing-4);
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

th {
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
    background-color: var(--color-neutral-50);
}

tbody tr:hover {
    background-color: var(--color-surface-hover);
}

/* ============================================
   FORMULAIRES (Base)
   ============================================ */

button, input, optgroup, select, textarea {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    margin: 0;
}

button, input {
    overflow: visible;
}

button, select {
    text-transform: none;
}

[type="button"],
[type="reset"],
[type="submit"],
button {
    -webkit-appearance: button;
    cursor: pointer;
}

button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
    border-style: none;
    padding: 0;
}

button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring {
    outline: 1px dotted ButtonText;
}

fieldset {
    margin: 0;
    padding: 0;
    border: 0;
}

legend {
    display: block;
    width: 100%;
    padding: 0;
    margin-bottom: var(--spacing-2);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
}

label {
    display: inline-block;
    margin-bottom: var(--spacing-2);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-primary);
}

textarea {
    resize: vertical;
}

[type="search"] {
    -webkit-appearance: textfield;
    outline-offset: -2px;
}

[type="search"]::-webkit-search-decoration {
    -webkit-appearance: none;
}

::-webkit-file-upload-button {
    -webkit-appearance: button;
    font: inherit;
}

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

[hidden] {
    display: none !important;
}

.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;
}

.sr-only-focusable:active,
.sr-only-focusable:focus {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

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

/* ============================================
   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;
    }
    
    a[href]::after {
        content: " (" attr(href) ")";
    }
    
    abbr[title]::after {
        content: " (" attr(title) ")";
    }
    
    a[href^="#"]::after,
    a[href^="javascript:"]::after {
        content: "";
    }
    
    pre,
    blockquote {
        border: 1px solid #999;
        page-break-inside: avoid;
    }
    
    thead {
        display: table-header-group;
    }
    
    tr,
    img {
        page-break-inside: avoid;
    }
    
    p,
    h2,
    h3 {
        orphans: 3;
        widows: 3;
    }
    
    h2,
    h3 {
        page-break-after: avoid;
    }
}
