/**
 * WorkShift Base — Reset, Typography, Focus, Scrollbars
 * Enterprise SaaS Design System
 */

/* ── Reset ── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

body {
    font-family: var(--font-sans);
    font-size: var(--text-body);
    font-weight: var(--weight-normal);
    line-height: var(--leading-body);
    background-color: var(--color-bg-page);
    color: var(--color-text);
    min-height: 100vh;
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    touch-action: manipulation;
}

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-sans);
    color: var(--color-text);
    font-weight: var(--weight-semibold);
    line-height: var(--leading-heading);
    letter-spacing: -0.01em;
}

h1 { font-size: var(--text-h1); }
h2 { font-size: var(--text-h2); }
h3 { font-size: var(--text-h3); }
h4 { font-size: var(--text-body-lg); font-weight: var(--weight-medium); }
h5 { font-size: var(--text-body); font-weight: var(--weight-medium); }
h6 { font-size: var(--text-caption); font-weight: var(--weight-medium); }

p {
    margin-bottom: var(--space-4);
}
p:last-child {
    margin-bottom: 0;
}

a {
    color: var(--color-link);
    text-decoration: none;
    transition: color var(--transition-fast);
}
a:hover {
    color: var(--color-link-hover);
    text-decoration: underline;
}

strong, b {
    font-weight: var(--weight-semibold);
}

img, svg, video, canvas {
    max-width: 100%;
    height: auto;
    vertical-align: middle;
}

/* ── Focus Visibility ── */
:focus-visible {
    outline: 2px solid var(--color-border-focused);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* ── Tabular Numerals ── */
.tabular-nums {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

/* ── Lane/Column Captions ── */
.caption-uppercase {
    font-size: 11px;
    font-weight: var(--weight-semibold);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-text-subtlest);
}

/* ── Screen Reader Utility ── */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ── Hidden ── */
.hidden {
    display: none !important;
}

/* ── Scrollbars ── */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: var(--radius-full);
    border: 2px solid transparent;
    background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
    background-clip: content-box;
}

/* ── Form Base Reset ── */
input, select, textarea, button {
    font-family: inherit;
    font-size: 1rem;
    color: inherit;
}

/* ── Respect Reduced Motion ── */
@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;
    }
}

/* ── Text Color Utilities ── */
.text-subtle { color: var(--color-text-subtle); }
.text-subtlest { color: var(--color-text-subtlest); }
.text-brand { color: var(--color-brand); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-danger { color: var(--color-danger); }

/* ── Legacy compatibility aliases ── */
.text-muted { color: var(--color-text-subtle); }
.text-secondary { color: var(--color-text-subtle); }
.text-primary { color: var(--color-brand); }
.text-xs { font-size: var(--text-caption); }
.text-sm { font-size: var(--text-body); }
.text-base { font-size: var(--text-body-lg); }
.text-lg { font-size: var(--text-h3); }
.text-xl { font-size: var(--text-h2); }
.text-2xl { font-size: var(--text-h1); }
.text-3xl { font-size: var(--text-hero); }
.font-bold { font-weight: var(--weight-semibold); }
.font-semibold { font-weight: var(--weight-medium); }
.font-heading { font-family: var(--font-sans); }
.font-normal { font-weight: var(--weight-normal); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.uppercase { text-transform: uppercase; }
.tracking-wider { letter-spacing: 0.05em; }

/* ── Layout Utility Classes ── */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }
.mx-auto { margin-left: auto; margin-right: auto; }
.ml-auto { margin-left: auto; }
.w-full { width: 100%; }
.max-w-md { max-width: 28rem; }
.max-w-lg { max-width: 32rem; }
.max-w-xl { max-width: 36rem; }
.max-w-2xl { max-width: 42rem; }
.relative { position: relative; }

/* ── Spacing utilities ── */
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.mb-12 { margin-bottom: var(--space-12); }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }
.pb-3 { padding-bottom: var(--space-3); }
.pb-4 { padding-bottom: var(--space-4); }
.pb-6 { padding-bottom: var(--space-6); }
.pt-2 { padding-top: var(--space-2); }
.pt-3 { padding-top: var(--space-3); }
.pt-4 { padding-top: var(--space-4); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }
.py-8 { padding-top: var(--space-8); padding-bottom: var(--space-8); }

/* ── Border utilities ── */
.border-t { border-top: 1px solid var(--color-border); }
.border-b { border-bottom: 1px solid var(--color-border); }
.border-subtle { border-color: var(--color-border); }
.border-primary { border-color: var(--color-brand); }

/* ── Block/Inline ── */
.block { display: block; }
.inline-block { display: inline-block; }
