/*
 * QazStack Reset v2.0
 * Minimal, modern CSS reset.
 * v2.0: improved table styles, sr-only utility, better focus, print basics
 */

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

* {
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    -moz-tab-size: 4;
    tab-size: 4;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: var(--line-height);
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

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

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

button {
    cursor: pointer;
    background: none;
    border: none;
}

a {
    color: var(--accent);
    text-decoration: none;
}

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

h1, h2, h3, h4, h5, h6 {
    line-height: var(--line-height-tight);
    font-weight: var(--font-semibold);
    color: var(--text);
    text-wrap: balance;
}

h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }

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

ul, ol {
    padding-left: var(--space-lg);
}

code, pre {
    font-family: var(--font-mono);
    font-size: var(--font-size-sm);
}

pre {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-md);
    overflow-x: auto;
}

code {
    background: var(--bg-secondary);
    padding: 0.15em 0.4em;
    border-radius: var(--radius-sm);
}

pre code {
    background: none;
    padding: 0;
    border-radius: 0;
}

hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: var(--space-xl) 0;
}

/* ─── Tables (improved v2) ─── */

table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    font-variant-numeric: tabular-nums lining-nums;
}

th, td {
    padding: var(--space-sm) var(--space-md);
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    vertical-align: top;
}

th {
    font-weight: var(--font-semibold);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 1;
}

thead tr {
    border-bottom: 2px solid var(--border);
}

tbody tr {
    transition: background-color var(--transition-fast);
}

tbody tr:hover {
    background: var(--surface-hover);
}

/* Striped variant (opt-in via .table--striped) */
.table--striped tbody tr:nth-child(even) {
    background: var(--bg-secondary);
}
.table--striped tbody tr:nth-child(even):hover {
    background: var(--surface-hover);
}

/* Compact variant */
.table--compact th,
.table--compact td {
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-size-sm);
}

/* Borderless variant */
.table--borderless th,
.table--borderless td {
    border-bottom: none;
}

/* Numeric cells align right */
td[data-type="number"],
th[data-type="number"] {
    text-align: right;
}

/* Responsive table wrapper */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: var(--space-md);
}

/* ─── Focus ring ─── */

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Remove outline for mouse users */
:focus:not(:focus-visible) {
    outline: none;
}

/* ─── Selection ─── */

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

/* ─── Scrollbar (webkit) ─── */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

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

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ─── Accessibility: Screen-reader only ─── */

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

.sr-only-focusable:focus,
.sr-only-focusable:active {
    position: static;
    width: auto;
    height: auto;
    padding: inherit;
    margin: inherit;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* ─── Accessibility: 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;
    }
}

/* ─── Print basics ─── */

@media print {
    body {
        background: white;
        color: black;
    }
    .no-print {
        display: none !important;
    }
    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.85em;
        color: #666;
    }
}
