/**
 * Base Styles
 * 기본 HTML 요소 스타일 정의 및 리셋
 */

/* ==================== CSS Reset ==================== */

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;
}

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

/* ==================== Typography ==================== */

h1, h2, h3, h4, h5, h6 {
    font-weight: var(--font-semibold);
    line-height: var(--leading-tight);
    color: var(--text-primary);
    margin-bottom: var(--space-4);
}

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

p {
    margin-bottom: var(--space-4);
    color: var(--text-primary);
}

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

a:hover {
    color: var(--interactive-hover);
    text-decoration: underline;
}

a:focus-visible {
    outline: 2px solid var(--border-focus);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

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

em, i {
    font-style: italic;
}

code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    padding: 0.125rem 0.25rem;
    background-color: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

pre {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
    padding: var(--space-4);
    background-color: var(--bg-tertiary);
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin-bottom: var(--space-4);
}

pre code {
    padding: 0;
    background-color: transparent;
}

/* ==================== Lists ==================== */

ul, ol {
    margin-bottom: var(--space-4);
    padding-left: var(--space-6);
}

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

/* ==================== Images ==================== */

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

/* ==================== Tables ==================== */

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: var(--space-4);
}

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

th {
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    background-color: var(--bg-secondary);
}

/* ==================== Forms ==================== */

input,
textarea,
select,
button {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

/* ==================== Accessibility ==================== */

/* Skip Link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--interactive-default);
    color: var(--text-inverse);
    padding: var(--space-2) var(--space-4);
    text-decoration: none;
    border-radius: 0 0 var(--radius-md) 0;
    z-index: var(--z-tooltip);
}

.skip-link:focus {
    top: 0;
}

/* Focus Visible */
*:focus {
    outline: 2px solid rgba(59, 130, 246, 0.5);
    outline-offset: 2px;
}

*:focus:not(:focus-visible) {
    outline: none;
}

/* 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-width: 0;
}

/* ==================== Scrollbar ==================== */

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

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

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

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

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

/* ==================== Selection ==================== */

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

/* ==================== Utilities ==================== */

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

.hidden { display: none !important; }
.block { display: block; }
.inline-block { display: inline-block; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }

.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }
