/* === BASE STYLES ===
   기본적인 HTML 요소들의 스타일과 전역 설정을 정의합니다. */

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 12rem;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-base);
    background-color: var(--bg-dark);
    color: var(--text-light);
    line-height: 1.7;
    overflow-x: hidden;
    font-weight: 400;
    image-rendering: pixelated;
    background-image: linear-gradient(
            180deg,
            rgba(239, 68, 68, 0.1),
            rgba(239, 68, 68, 0) 20rem
        ),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 1.2rem,
            rgba(255, 255, 255, 0.018) 1.2rem,
            rgba(255, 255, 255, 0.018) 1.3rem
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 1.2rem,
            rgba(255, 255, 255, 0.014) 1.2rem,
            rgba(255, 255, 255, 0.014) 1.3rem
        );
    background-attachment: fixed;
}

/* === 접근성 === */

/* 스킵 링크 */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary);
    color: var(--text-light);
    padding: 0.8rem 1.2rem;
    z-index: 1000;
    transition: top 0.2s ease;
}
.skip-link:focus,
.skip-link:focus-visible {
    top: 0;
    outline: 3px solid var(--revealed);
    outline-offset: 2px;
}

/* 키보드 사용자를 위한 포커스 링 */
.btn:focus-visible,
.tab:focus-visible,
input:focus-visible,
.slot-machine .reel:focus-visible,
.competency-tab:focus-visible {
    outline: 3px solid var(--revealed);
    outline-offset: 2px;
}

/* 스크린 리더 전용 텍스트 */
.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;
}

/* === 모션 감소 지원 === */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto;
    }
}

/* === 기본 타이포그래피 === */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-display);
    line-height: 1.2;
    margin-bottom: var(--space-md);
    letter-spacing: 0;
}

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

/* === 링크 === */
a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

/* === 폼 요소 === */
input,
textarea,
select {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

input[type='text'],
input[type='email'],
input[type='password'],
textarea {
    border: 0.3rem solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 1rem var(--space-md);
    background: rgba(10, 14, 24, 0.78);
    color: var(--text-light);
    transition: none;
    box-shadow: 0.3rem 0.3rem 0 var(--border-strong);
}

input[type='text']:focus,
input[type='email']:focus,
input[type='password']:focus,
textarea:focus {
    border-color: var(--text-light);
    outline: none;
    background: rgba(10, 14, 24, 0.96);
    box-shadow: 0.3rem 0.3rem 0 var(--border-strong),
        0 0 0 0.3rem rgba(255, 255, 255, 0.22);
}

/* 하위 층위 구분: '단계 활동' 및 '세부사항' 입력 들여쓰기 */
input[placeholder='단계 활동'],
input[placeholder='세부사항'] {
    margin-left: var(--space-md);
    width: calc(100% - var(--space-md));
    box-sizing: border-box;
}

/* === 유틸리티 클래스 === */
.hidden {
    display: none;
}

.visually-hidden {
    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;
}

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

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

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

/* === 플렉스 유틸리티 === */
.flex {
    display: flex;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.flex-column {
    display: flex;
    flex-direction: column;
}

/* === 그리드 유틸리티 === */
.grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--space-md);
}

/* === 아이콘 === */
.icon {
    width: 2.4rem;
    height: 2.4rem;
    fill: currentColor;
}
