/**
 * Base Styles / Reset - Pixel Style
 * HTML, body, typography, and element resets
 */

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: none;
    -moz-osx-font-smoothing: unset;
    text-rendering: optimizeSpeed;
    scroll-behavior: auto;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    font-weight: var(--font-normal);
    line-height: var(--leading-normal);
    color: var(--text-primary);
    background-color: var(--bg-body);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-sans);
    font-weight: var(--font-bold);
    line-height: var(--leading-tight);
    color: var(--text-primary);
    margin-bottom: var(--space-md);
}

h1 { font-size: var(--text-5xl); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-3xl); }
h4 { font-size: var(--text-2xl); }
h5 { font-size: var(--text-xl); }
h6 { font-size: var(--text-lg); }

h1:last-child, h2:last-child, h3:last-child,
h4:last-child, h5:last-child, h6:last-child {
    margin-bottom: 0;
}

p {
    margin-bottom: var(--space-md);
    line-height: var(--leading-relaxed);
}

p:last-child {
    margin-bottom: 0;
}

a {
    color: var(--primary-light);
    text-decoration: none;
    transition: color var(--transition-fast) var(--ease-default);
}

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

a:active {
    color: var(--primary-dark);
}

ul, ol {
    list-style: none;
    margin-bottom: var(--space-md);
}

li {
    margin-bottom: var(--space-sm);
}

/* Code - Pixel Style */
code, pre {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    background: var(--bg-elevated);
    border-radius: 0;
}

code {
    padding: 0.125rem 0.375rem;
    border: 1px solid var(--border);
}

pre {
    padding: var(--space-md);
    overflow-x: auto;
    line-height: var(--leading-relaxed);
}

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

kbd {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    background: var(--bg-elevated);
    border: 2px solid var(--border);
    border-radius: 0;
    box-shadow: var(--shadow-sm);
}

/* Blockquote - Pixel Style */
blockquote {
    padding-left: var(--space-md);
    margin-left: 0;
    margin-bottom: var(--space-md);
    border-left: 4px solid var(--primary);
    color: var(--text-secondary);
    font-style: normal;
}

/* Horizontal Rule - Pixel Style */
hr {
    height: 2px;
    background: var(--border);
    border: none;
    margin: var(--space-xl) 0;
}

/* Tables - Pixel Style */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: var(--space-md);
    border: 2px solid var(--border);
}

thead {
    background: var(--bg-elevated);
}

th, td {
    padding: var(--space-md);
    text-align: left;
    border-bottom: 2px solid var(--border);
    border-right: 1px solid var(--border);
}

th {
    font-weight: var(--font-bold);
    color: var(--text-primary);
}

th:last-child, td:last-child {
    border-right: none;
}

tbody tr:nth-child(even) {
    background: var(--bg-elevated);
}

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

/* Images */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

figure {
    margin-bottom: var(--space-md);
}

figcaption {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    text-align: center;
    margin-top: var(--space-sm);
}

/* Forms - Pixel Style */
input,
textarea,
select,
button {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

label {
    display: block;
    margin-bottom: var(--space-xs);
    font-weight: var(--font-bold);
    color: var(--text-primary);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="search"],
input[type="date"],
input[type="datetime-local"],
textarea,
select {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-elevated);
    border: 2px solid var(--border);
    border-radius: 0;
    color: var(--text-primary);
    transition: border-color var(--transition-fast) var(--ease-default);
    box-shadow: var(--shadow-input);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--shadow-input), 0 0 0 2px var(--primary);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

/* Disabled State */
input:disabled,
textarea:disabled,
select:disabled,
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Selection */
::selection {
    background: var(--primary);
    color: #ffffff;
}

::-moz-selection {
    background: var(--primary);
    color: #ffffff;
}

/* Scrollbar - Pixel Style */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-card);
    border: 1px solid var(--border);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border: 2px solid var(--border);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* Focus Visible - Pixel Style */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 0;
}

/* Utility Classes */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-info { color: var(--info); }

.font-bold { font-weight: var(--font-bold); }
.font-semibold { font-weight: var(--font-semibold); }
.font-medium { font-weight: var(--font-medium); }
.font-normal { font-weight: var(--font-normal); }

.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-3xl { font-size: var(--text-3xl); }

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.m-0 { margin: 0; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.ml-0 { margin-left: 0; }
.mr-0 { margin-right: 0; }

.mt-1 { margin-top: var(--space-xs); }
.mt-2 { margin-top: var(--space-sm); }
.mt-3 { margin-top: var(--space-md); }
.mt-4 { margin-top: var(--space-lg); }
.mt-5 { margin-top: var(--space-xl); }

.mb-1 { margin-bottom: var(--space-xs); }
.mb-2 { margin-bottom: var(--space-sm); }
.mb-3 { margin-bottom: var(--space-md); }
.mb-4 { margin-bottom: var(--space-lg); }
.mb-5 { margin-bottom: var(--space-xl); }

.p-0 { padding: 0; }
.p-1 { padding: var(--space-xs); }
.p-2 { padding: var(--space-sm); }
.p-3 { padding: var(--space-md); }
.p-4 { padding: var(--space-lg); }
.p-5 { padding: var(--space-xl); }

.d-none { display: none; }
.d-block { display: block; }
.d-inline { display: inline; }
.d-inline-block { display: inline-block; }
.d-flex { display: flex; }
.d-grid { display: grid; }

.flex-wrap { flex-wrap: wrap; }
.flex-nowrap { flex-wrap: nowrap; }

.align-items-start { align-items: flex-start; }
.align-items-center { align-items: center; }
.align-items-end { align-items: flex-end; }

.justify-content-start { justify-content: flex-start; }
.justify-content-center { justify-content: center; }
.justify-content-end { justify-content: flex-end; }
.justify-content-between { justify-content: space-between; }

.gap-1 { gap: var(--space-xs); }
.gap-2 { gap: var(--space-sm); }
.gap-3 { gap: var(--space-md); }
.gap-4 { gap: var(--space-lg); }

.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

@media (max-width: 768px) {
    .container {
        padding: 0 var(--space-md);
    }
}

.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;
}
