/* ============================================================
 * 브라우저 초기화 (CSS Reset)
 * ============================================================
 * store-locate reset.css 기반. variables.css 다음으로 로드할 것.
 * ============================================================
 */

/* ===========================================
 * 기본 초기화
 * =========================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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


/* ===========================================
 * HTML & Body
 * =========================================== */
html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-family-base);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  color: var(--color-gray-900);
  background: var(--color-white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}


/* ===========================================
 * 제목
 * =========================================== */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--color-gray-900);
}

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


/* ===========================================
 * 텍스트 요소
 * =========================================== */
p { margin: 0; }

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

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

strong, b { font-weight: var(--font-weight-bold); }
em, i { font-style: italic; }
small { font-size: var(--font-size-sm); }


/* ===========================================
 * 리스트
 * =========================================== */
ul, ol { list-style: none; }
li { list-style: none; }


/* ===========================================
 * 버튼
 * =========================================== */
button {
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}


/* ===========================================
 * 입력창
 * =========================================== */
/* :where()로 특이도 0 유지 → .input 등 클래스 스타일이 항상 우선 */
:where(input:not([type="checkbox"]):not([type="radio"])),
:where(textarea),
:where(select) {
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
  outline: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}

/* 체크박스/라디오는 기본 브라우저 렌더링 유지 + 커스텀 스타일 */
input[type="checkbox"],
input[type="radio"] {
  width: 18px;
  height: 18px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--color-primary);
  flex-shrink: 0;
}

input::placeholder,
textarea::placeholder {
  color: var(--color-gray-400);
  opacity: 1;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px white inset;
  transition: background-color 5000s ease-in-out 0s;
}


/* ===========================================
 * 이미지 & 미디어
 * =========================================== */
img,
video,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

svg {
  fill: currentColor;
}


/* ===========================================
 * 테이블
 * =========================================== */
table {
  border-collapse: collapse;
  border-spacing: 0;
  width: 100%;
}

th, td {
  text-align: left;
  padding: 0;
}


/* ===========================================
 * 기타
 * =========================================== */
hr {
  border: none;
  border-top: 1px solid var(--color-gray-200);
  margin: 0;
}

blockquote {
  margin: 0;
  padding: 0;
}

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

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


/* ===========================================
 * 스크롤바
 * =========================================== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--color-gray-300);
  border-radius: var(--radius-sm);
}

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

* {
  scrollbar-width: thin;
  scrollbar-color: var(--color-gray-300) var(--color-gray-100);
}


/* ===========================================
 * 모바일 최적화
 * =========================================== */
@media (hover: none) {
  * {
    -webkit-overflow-scrolling: touch;
  }
}

html,
body {
  overflow-x: hidden;
}


/* ===========================================
 * 접근성
 * =========================================== */
*:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

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