/* ============================================================================
 * bySENDA — Base CSS v1.0
 * ----------------------------------------------------------------------------
 * Reset moderno + tipografia global + utilidades minimas.
 * Depende de tokens.css.
 * ========================================================================= */

/* ---------- 1. Reset moderno (basado en Josh Comeau + ajustes a11y) -------- */

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

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  min-height: 100vh;
  font-family: var(--bys-font-secondary);
  font-size: var(--bys-font-size-base);
  line-height: var(--bys-line-height-normal);
  color: var(--bys-text-primary);
  background-color: var(--bys-bg-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

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

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

a {
  color: var(--bys-text-link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color var(--bys-duration-fast) var(--bys-ease-standard);
}

a:hover {
  color: var(--bys-brand-navy);
  text-decoration-thickness: 2px;
}

p, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}

ul, ol {
  padding-left: var(--bys-space-5);
}

hr {
  border: 0;
  border-top: 1px solid var(--bys-border-subtle);
  margin: var(--bys-space-6) 0;
}

/* ---------- 2. Tipografia global ------------------------------------------ */

h1, h2, h3, h4 {
  font-family: var(--bys-font-primary);
  font-weight: var(--bys-font-weight-semibold);
  line-height: var(--bys-line-height-tight);
  color: var(--bys-text-primary);
  letter-spacing: var(--bys-letter-spacing-tight);
}

h1 { font-size: clamp(var(--bys-font-size-2xl), 5vw + 1rem, var(--bys-font-size-4xl)); }
h2 { font-size: clamp(var(--bys-font-size-xl), 3vw + 1rem, var(--bys-font-size-3xl)); }
h3 { font-size: var(--bys-font-size-xl); }
h4 { font-size: var(--bys-font-size-lg); }
h5 { font-size: var(--bys-font-size-md); font-family: var(--bys-font-secondary); font-weight: 600; }
h6 { font-size: var(--bys-font-size-base); font-family: var(--bys-font-secondary); font-weight: 600; }

p { line-height: var(--bys-line-height-relaxed); }

.bys-text-tagline {
  font-family: var(--bys-font-primary);
  font-style: italic;
  font-weight: var(--bys-font-weight-regular);
  color: var(--bys-brand-navy);
}

.bys-text-eyebrow {
  font-family: var(--bys-font-secondary);
  font-size: var(--bys-font-size-sm);
  font-weight: var(--bys-font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--bys-letter-spacing-wide);
  color: var(--bys-brand-sky);
}

.bys-text-muted { color: var(--bys-text-muted); }
.bys-text-small { font-size: var(--bys-font-size-sm); }

/* ---------- 3. Focus visible (WCAG 2.4.7 — AA) ---------------------------- */

:focus { outline: none; }

:focus-visible {
  outline: var(--bys-focus-ring-width) solid var(--bys-focus-ring-color);
  outline-offset: var(--bys-focus-ring-offset);
  border-radius: var(--bys-radius-sm);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: var(--bys-focus-ring-width) solid var(--bys-focus-ring-color);
  outline-offset: var(--bys-focus-ring-offset);
}

/* ---------- 4. Skip-to-content (WCAG 2.4.1) ------------------------------- */

.bys-skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--bys-brand-navy);
  color: var(--bys-text-on-primary);
  padding: var(--bys-space-2) var(--bys-space-4);
  z-index: var(--bys-z-skip);
  text-decoration: none;
  border-radius: 0 0 var(--bys-radius-md) 0;
}

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

/* ---------- 5. Screen reader only ----------------------------------------- */

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

/* ---------- 6. Container + layout utilities ------------------------------- */

.bys-container {
  width: 100%;
  max-width: var(--bys-container-xl);
  margin: 0 auto;
  padding-left: var(--bys-space-4);
  padding-right: var(--bys-space-4);
}

@media (min-width: 768px) {
  .bys-container { padding-left: var(--bys-space-6); padding-right: var(--bys-space-6); }
}

.bys-stack > * + * { margin-top: var(--bys-space-4); }
.bys-stack-sm > * + * { margin-top: var(--bys-space-2); }
.bys-stack-lg > * + * { margin-top: var(--bys-space-8); }

.bys-grid {
  display: grid;
  gap: var(--bys-space-6);
}

.bys-grid-cols-2 { grid-template-columns: 1fr; }
.bys-grid-cols-3 { grid-template-columns: 1fr; }
.bys-grid-cols-4 { grid-template-columns: 1fr; }

@media (min-width: 640px) {
  .bys-grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 768px) {
  .bys-grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
  .bys-grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .bys-grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- 7. Secciones ---------------------------------------------------*/

.bys-section {
  padding-top: var(--bys-space-10);
  padding-bottom: var(--bys-space-10);
}

@media (min-width: 768px) {
  .bys-section {
    padding-top: var(--bys-space-16);
    padding-bottom: var(--bys-space-16);
  }
}

.bys-section--muted { background-color: var(--bys-bg-subtle); }
.bys-section--inverted {
  background-color: var(--bys-bg-inverted);
  color: var(--bys-text-on-primary);
}
.bys-section--inverted h1,
.bys-section--inverted h2,
.bys-section--inverted h3 {
  color: var(--bys-text-on-primary);
}

/* ---------- 8. Print ------------------------------------------------------ */

@media print {
  .bys-skip-link,
  .bys-no-print { display: none !important; }
  body { background: white; color: black; }
}
