/*
============================================================
 ROBERT VARÓN | PLATAFORMA WEB CORPORATIVA
============================================================

 Archivo: main.css
 Módulo: Estilos globales
 Descripción:
 Normalización, tipografía, contenedores, accesibilidad
 y fundamentos visuales de la plataforma.

 Arquitectura: HTML5 + CSS3 + JavaScript ES6+
 Dependencias: variables.css

============================================================
*/


/* =========================================================
   01. RESET CSS
========================================================= */

*,
*::before,
*::after {
    box-sizing: border-box;
}

* {
    margin: 0;
    padding: 0;
}

html {
    font-size: 100%;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    min-width: 320px;
    min-height: 100vh;

    background-color: var(--bg-body);
    color: var(--color-gray-900);

    font-family: var(--font-primary);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-regular);
    line-height: var(--line-height-normal);

    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body,
button,
input,
textarea,
select {
    font-family: var(--font-primary);
}


/* =========================================================
   02. DOCUMENTO Y DESPLAZAMIENTO
========================================================= */

html {
    scroll-behavior: smooth;
    scroll-padding-top: 6rem;
}

body {
    overflow-x: clip;
}

body.no-scroll {
    overflow: hidden;
}


/* =========================================================
   03. ELEMENTOS MULTIMEDIA
========================================================= */

img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
}

img {
    height: auto;
    vertical-align: middle;
}

picture {
    width: 100%;
}

video {
    height: auto;
}

svg {
    overflow: visible;
}


/* =========================================================
   04. TIPOGRAFÍA GLOBAL
========================================================= */

h1,
h2,
h3,
h4,
h5,
h6 {
    color: inherit;
    font-family: var(--font-primary);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-tight);
    text-wrap: balance;
}

h1 {
    font-size: clamp(2.25rem, 5vw, 4rem);
    letter-spacing: -0.035em;
}

h2 {
    font-size: clamp(1.875rem, 3.5vw, 3rem);
    letter-spacing: -0.025em;
}

h3 {
    font-size: clamp(1.375rem, 2.5vw, 2rem);
    letter-spacing: -0.015em;
}

h4 {
    font-size: clamp(1.125rem, 2vw, 1.5rem);
}

h5 {
    font-size: var(--font-size-md);
}

h6 {
    font-size: var(--font-size-base);
}

p {
    max-width: 75ch;
    overflow-wrap: break-word;
}

small {
    font-size: var(--font-size-sm);
}

strong,
b {
    font-weight: var(--font-weight-bold);
}

em,
i {
    font-style: italic;
}

blockquote {
    border-left: 3px solid var(--color-secondary);
    padding-left: var(--space-6);
    color: var(--color-gray-600);
    font-style: italic;
}


/* =========================================================
   05. ENLACES
========================================================= */

a {
    color: inherit;
    text-decoration: none;
    text-underline-offset: 0.2em;
    -webkit-tap-highlight-color: transparent;
}

a[href] {
    cursor: pointer;
}

a:not([class]):hover {
    text-decoration: underline;
}

a:not([class]) {
    text-decoration-thickness: 1px;
}


/* =========================================================
   06. LISTAS
========================================================= */

ul,
ol {
    padding-left: 1.5rem;
}

nav ul,
nav ol,
[role="list"] {
    list-style: none;
    padding-left: 0;
}


/* =========================================================
   07. BOTONES Y CONTROLES
========================================================= */

button,
input,
textarea,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

button,
input,
select,
textarea {
    color: inherit;
}

input,
textarea,
select {
    max-width: 100%;
}

textarea {
    resize: vertical;
}

::placeholder {
    color: var(--color-gray-600);
    opacity: 1;
}


/* =========================================================
   08. ACCESIBILIDAD
========================================================= */

:focus-visible {
    outline: var(--focus-outline);
    outline-offset: var(--focus-offset);
}

:focus:not(:focus-visible) {
    outline: none;
}

[hidden] {
    display: none !important;
}

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.skip-link {
    position: fixed;
    top: -100px;
    left: var(--space-4);
    z-index: 9999;

    padding: var(--space-3) var(--space-6);

    background: var(--color-primary);
    color: var(--color-white);

    border: 2px solid var(--color-secondary);
    border-radius: var(--radius-md);

    font-weight: var(--font-weight-semibold);
}

.skip-link:focus {
    top: var(--space-4);
}


/* =========================================================
   09. CONTENEDORES
========================================================= */

.container {
    width: min(
        calc(100% - (var(--container-padding) * 2)),
        var(--container-width)
    );

    margin-inline: auto;
}

.container-fluid {
    width: 100%;
    padding-inline: var(--container-padding);
}

.container-narrow {
    width: min(
        calc(100% - (var(--container-padding) * 2)),
        800px
    );

    margin-inline: auto;
}


/* =========================================================
   10. SECCIONES
========================================================= */

.section {
    padding-block: clamp(4rem, 7vw, 6rem);
}

.section-sm {
    padding-block: clamp(2.5rem, 5vw, 4rem);
}

.section-lg {
    padding-block: clamp(5rem, 9vw, 8rem);
}

.section-light {
    background-color: var(--bg-section);
}

.section-dark {
    background-color: var(--bg-dark);
    color: var(--color-white);
}


/* =========================================================
   11. UTILIDADES DE TEXTO
========================================================= */

.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.text-gold {
    color: var(--color-secondary);
}

.text-white {
    color: var(--color-white);
}

.text-muted {
    color: var(--color-gray-600);
}

.text-uppercase {
    text-transform: uppercase;
}

.text-balance {
    text-wrap: balance;
}

.text-pretty {
    text-wrap: pretty;
}


/* =========================================================
   12. UTILIDADES DE DISTRIBUCIÓN
========================================================= */

.flex {
    display: flex;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.grid {
    display: grid;
}

.hidden {
    display: none !important;
}

.w-full {
    width: 100%;
}


/* =========================================================
   13. SELECCIÓN DE TEXTO
========================================================= */

::selection {
    background-color: var(--color-secondary);
    color: var(--color-primary);
}

::-moz-selection {
    background-color: var(--color-secondary);
    color: var(--color-primary);
}


/* =========================================================
   14. TABLAS
========================================================= */

table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
}

th,
td {
    padding: var(--space-3);
    text-align: left;
}

th {
    font-weight: var(--font-weight-semibold);
}


/* =========================================================
   15. ELEMENTOS HORIZONTALES
========================================================= */

hr {
    height: 1px;
    border: 0;
    background-color: var(--color-gray-200);
}


/* =========================================================
   16. MOVIMIENTO REDUCIDO
========================================================= */

@media (prefers-reduced-motion: reduce) {

    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

}


/* =========================================================
   17. AJUSTES RESPONSIVE GENERALES
========================================================= */

@media (max-width: 768px) {

    :root {
        --container-padding: 1.25rem;
    }

    html {
        scroll-padding-top: 5rem;
    }

    .section {
        padding-block: 4rem;
    }

    .section-lg {
        padding-block: 5rem;
    }

}

@media (max-width: 480px) {

    :root {
        --container-padding: 1rem;
    }

    .section {
        padding-block: 3.5rem;
    }

    .section-sm {
        padding-block: 2.5rem;
    }

}