/* ==========================================================================
   base.css — Reset moderno + estilos base
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 1rem);
}

body {
  margin: 0;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-base);
  font-size: var(--fs-body);
  font-weight: var(--fw-regular);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Bloquea el scroll cuando hay un panel/modal abierto */
body.is-locked {
  overflow: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0 0 var(--sp-md);
  color: var(--color-heading);
  font-weight: var(--fw-bold);
  line-height: var(--lh-heading);
  text-wrap: balance;
}

h1 {
  font-size: var(--fs-h1);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
}

h2 {
  font-size: var(--fs-h2);
}

h3 {
  font-size: var(--fs-h3);
}

h4 {
  font-size: var(--fs-h4);
}

p {
  margin: 0 0 var(--sp-md);
  text-wrap: pretty;
}

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

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out),
    opacity var(--dur-fast) var(--ease-out);
}

a:hover {
  color: var(--color-heading);
}

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

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

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

/* El `[hidden]` del navegador pierde contra cualquier regla de autor con
   `display` (por ejemplo `.btn { display: inline-flex }`), asi que un elemento
   con clase seguiria visible. Este reset hace que el atributo siempre gane. */
[hidden] {
  display: none !important; /* justificado: reset del atributo hidden */
}

/* --------------------------------------------------------------------------
   Accesibilidad
   -------------------------------------------------------------------------- */

:where(a, button, [tabindex]):focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

.skip-link {
  position: absolute;
  top: -100px;
  left: var(--sp-md);
  z-index: calc(var(--z-modal) + 1);
  padding: var(--sp-sm) var(--sp-md);
  background-color: var(--color-accent);
  color: var(--color-on-accent);
  font-weight: var(--fw-bold);
  border-radius: var(--radius-sm);
  transition: top var(--dur-fast) var(--ease-out);
}

.skip-link:focus {
  top: var(--sp-md);
}

.visually-hidden {
  position: absolute !important; /* justificado: patron estandar de a11y */
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

::selection {
  background-color: var(--color-accent);
  color: var(--color-on-accent);
}

/* --------------------------------------------------------------------------
   Scrollbar (solo cosmetico, degrada sin problema)
   -------------------------------------------------------------------------- */

@supports selector(::-webkit-scrollbar) {
  ::-webkit-scrollbar {
    width: 10px;
  }

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

  ::-webkit-scrollbar-thumb {
    background-color: var(--color-border);
    border-radius: var(--radius-pill);
  }

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