/* ==========================================================================
   TREVIX · Base: reset, tipografía, accesibilidad y utilidades
   ========================================================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

* {
    margin: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    color-scheme: dark;
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
    overflow-x: clip;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: var(--fs-base);
    line-height: 1.55;
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

img,
picture,
video,
svg {
    display: block;
    max-width: 100%;
}

input,
button,
textarea,
select {
    font: inherit;
    color: inherit;
}

button {
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
}

a {
    color: inherit;
    text-decoration: none;
}

ul,
ol {
    padding: 0;
    list-style: none;
}

h1,
h2,
h3,
h4 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
    text-wrap: balance;
}

p {
    text-wrap: pretty;
}

fieldset {
    border: 0;
    padding: 0;
    min-width: 0;
}

dialog {
    padding: 0;
    border: 0;
    color: inherit;
    background: transparent;
}

[hidden] {
    display: none !important;
}

::selection {
    background: rgba(124, 58, 237, 0.45);
    color: #fff;
}

:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
    border-radius: var(--r-xs);
}

/* Barras de desplazamiento discretas */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    border: 3px solid transparent;
    background-clip: padding-box;
}

/* Iconos SVG */
.icon {
    width: 1.25em;
    height: 1.25em;
    flex-shrink: 0;
    stroke-width: 1.85;
}

/* Accesibilidad */
.sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: fixed;
    top: var(--sp-3);
    left: var(--sp-3);
    z-index: calc(var(--z-toast) + 1);
    padding: var(--sp-2) var(--sp-4);
    border-radius: var(--r-sm);
    background: var(--tx-white);
    color: var(--tx-black);
    font-weight: 600;
    transform: translateY(-200%);
    transition: transform var(--dur) var(--ease-out);
}

.skip-link:focus {
    transform: translateY(0);
}

/* Utilidades */
.text-gradient {
    background: var(--grad-text);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.container {
    width: min(100% - 2.5rem, 1200px);
    margin-inline: auto;
}

.muted-icon {
    color: var(--text-subtle);
    width: 1em;
    height: 1em;
}

/* Movimiento reducido: preferencia del sistema o del usuario */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

html.reduce-motion *,
html.reduce-motion *::before,
html.reduce-motion *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
}

html.reduce-motion {
    scroll-behavior: auto;
}
