/**
 * GRUPO VÍA MOTOS - Reset CSS Moderno
 * 
 * Reset CSS basado en las mejores prácticas modernas
 * Incluye normalización y estilos base
 * 
 * @version 1.0
 * @date Diciembre 2024
 */

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

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

/* ============================================
   HTML Y BODY
   ============================================ */

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

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-primary);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
    color: var(--color-gray-900);
    background-color: var(--color-white);
    overflow-x: hidden;
    min-height: 100vh;
}

/* ============================================
   HEADINGS
   ============================================ */

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

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ÁRRAFOS Y TEXTO
   ============================================ */

p {
    margin: 0;
    padding: 0;
}

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

a:hover {
    color: var(--color-primary-dark);
}

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

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

em, i {
    font-style: italic;
}

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

/* ============================================
   LISTAS
   ============================================ */

ul, ol {
    margin: 0;
    padding: 0;
    list-style: none;
}

/* ============================================
   IMÁGENES Y MEDIA
   ============================================ */

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

img {
    border-style: none;
}

svg {
    fill: currentColor;
}

/* ============================================
   FORMULARIOS
   ============================================ */

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

button, select {
    text-transform: none;
}

button,
[type="button"],
[type="reset"],
[type="submit"] {
    appearance: 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;
}

input, textarea, select {
    border: 1px solid var(--color-gray-300);
    border-radius: var(--border-radius-md);
    padding: var(--space-2) var(--space-3);
    background-color: var(--color-white);
    color: var(--color-gray-900);
    transition: border-color var(--transition-fast);
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(226, 6, 19, 0.1);
}

input::placeholder, textarea::placeholder {
    color: var(--color-gray-400);
}

textarea {
    resize: vertical;
}

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

legend {
    padding: 0;
}

/* ============================================
   TABLAS
   ============================================ */

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

th, td {
    text-align: left;
    padding: var(--space-3);
}

/* ============================================
   ELEMENTOS INTERACTIVOS
   ============================================ */

button {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

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

a, button, input, select, textarea {
    touch-action: manipulation;
}

/* ============================================
   CÓDIGO
   ============================================ */

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

pre {
    overflow: auto;
}

/* ============================================
   ELEMENTOS SEMÁNTICOS
   ============================================ */

article, aside, details, figcaption, figure,
footer, header, hgroup, main, menu, nav, section {
    display: block;
}

summary {
    display: list-item;
    cursor: pointer;
}

/* ============================================
   ELEMENTOS OCULTOS
   ============================================ */

[hidden] {
    display: none !important;
}

template {
    display: none;
}

/* ============================================
   ACCESIBILIDAD
   ============================================ */

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

/* ============================================
   SKIP LINKS
   ============================================ */

.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--color-primary);
    color: var(--color-white);
    padding: var(--space-2) var(--space-4);
    text-decoration: none;
    z-index: 100;
}

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

/* ============================================
   SELECCIÓN DE TEXTO
   ============================================ */

::selection {
    background-color: var(--color-primary);
    color: var(--color-white);
}

::-moz-selection {
    background-color: var(--color-primary);
    color: var(--color-white);
}

/* ============================================
   SCROLLBAR (Webkit)
   ============================================ */

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

::-webkit-scrollbar-track {
    background: var(--color-gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--color-gray-400);
    border-radius: var(--border-radius-full);
}

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

/* ============================================
   FOCUS VISIBLE (Mejora de accesibilidad)
   ============================================ */

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

:focus:not(:focus-visible) {
    outline: none;
}

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

    pre {
        white-space: pre-wrap !important;
    }

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