/* ============================================================
   RESET Y BASE — Mayorista a tu Casa
   ============================================================ */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
}

body {
  font-family: var(--font-body);
  background-color: var(--color-bg-page);
  color: var(--color-text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  position: relative;
}

@supports not (overflow-x: clip) {
  html, body {
    overflow-x: hidden;
  }
}

body.modal-open,
body.drawer-open {
  overflow: hidden;
}

/* Enlace de accesibilidad para saltar al contenido principal */
.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  background: var(--color-accent-600);
  color: #FFFFFF;
  padding: 0.75rem 1.25rem;
  z-index: 9999;
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-decoration: none;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: 1rem;
  outline: 3px solid #FFFFFF;
}

/* Accesibilidad y foco visible para teclado (WCAG 2.1) */
:focus-visible {
  outline: 3px solid var(--color-accent-500);
  outline-offset: 2px;
}

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

button {
  cursor: pointer;
  border: none;
  background: none;
}

a {
  color: inherit;
  text-decoration: none;
}

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

/* Clases utilitarias semánticas */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  line-height: 1.2;
  color: var(--color-primary-900);
  font-weight: 700;
}

.text-accent {
  color: var(--color-accent-600);
}

.text-success {
  color: var(--color-success-600);
}

.text-muted {
  color: var(--color-text-muted);
}

/* ============================================================
   BARRAS DE DESPLAZAMIENTO VISIBLES (SCROLLBARS)
   Garantiza que la barra de desplazamiento sea siempre visible en Mac,
   navegadores WebKit y Chromium (Safari, Chrome, Edge) y Firefox.
   ============================================================ */

/* Navegadores estándar (Firefox y modernos) */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--color-accent-500) var(--color-bg-surface);
}

/* Motores WebKit (Chrome, Safari, Edge, Opera en Mac y Windows) */
::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg-surface);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb {
  background: var(--color-accent-500);
  border-radius: var(--radius-full);
  border: 2px solid var(--color-bg-surface);
}

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

::-webkit-scrollbar-thumb:active {
  background: var(--color-accent-700);
}
