/* Reinicio, tipografía y utilidades comunes. */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--label);
  font: 400 15px/1.45 var(--font);
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* «hidden» siempre gana, aunque el componente fije su propio display */
[hidden] {
  display: none !important;
}

h1,
h2,
h3,
p,
ul,
ol,
figure,
dl,
dd {
  margin: 0;
}

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

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

button {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

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

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

/* La leyenda no participa en el «gap» de la rejilla del campo: se separa con margen */
legend {
  margin-bottom: 7px;
  padding: 0;
}

img {
  display: block;
  max-width: 100%;
}

svg {
  flex: none;
}

:focus-visible {
  outline: 3px solid color-mix(in oklab, var(--accent) 55%, transparent);
  outline-offset: 2px;
}

::selection {
  background: color-mix(in oklab, var(--accent) 28%, transparent);
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--r-ctl);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.skip-link:focus {
  top: 16px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.mono {
  font-family: var(--font-mono);
  letter-spacing: 0;
}

.num {
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--label-2);
}

.small {
  font-size: 13px;
}

.nowrap {
  white-space: nowrap;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Tintes: las clases tint-* fijan --tint y los componentes lo usan (avatar, etiqueta, icono…) */
.tint-blue { --tint: var(--blue); }
.tint-green { --tint: var(--green); --tint-text: var(--green-text); }
.tint-red { --tint: var(--red); }
.tint-orange { --tint: var(--orange); --tint-text: var(--orange-text); }
.tint-purple { --tint: var(--purple); }
.tint-pink { --tint: var(--pink); }
.tint-teal { --tint: var(--teal); }
.tint-indigo { --tint: var(--indigo); }
.tint-gray { --tint: var(--gray); }

/* Vidrio: fondo translúcido con desenfoque, filo de luz y sombra amplia. Solo para lo que flota sobre el contenido */
.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  backdrop-filter: blur(28px) saturate(180%);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass {
    background: var(--surface);
  }
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(-6px);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(0.98);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
