/* ============================================================
 * 브라우저 초기화 (CSS Reset)
 * ============================================================
 *
 * 📝 설명:
 * 모든 브라우저에서 동일한 기본 스타일을 적용하기 위한 초기화 CSS입니다.
 * 브라우저마다 다른 기본값을 제거하고 일관된 기준을 만듭니다.
 *
 * ⚠️ 중요:
 * 1. 이 파일은 variables.css 다음으로 로드해야 합니다
 * 2. 이 파일을 수정하면 전체 레이아웃이 깨질 수 있습니다
 * 3. 필요한 스타일은 common.css나 다른 파일에 추가하세요
 *
 * 🎯 목적:
 * - 브라우저 기본 margin, padding 제거
 * - box-sizing을 border-box로 통일
 * - 일관된 폰트 적용
 * - 버튼, 입력창 등의 기본 스타일 초기화
 *
 * ============================================================
 */


/* ===========================================
 * 기본 초기화
 * ===========================================
 */

/* 모든 요소의 margin, padding 제거 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* 가상 요소도 포함 */
*::before,
*::after {
  box-sizing: border-box;
}


/* ===========================================
 * HTML & Body 기본 설정
 * ===========================================
 */

html {
  /* 부드러운 스크롤 */
  scroll-behavior: smooth;

  /* 기본 폰트 크기 (1rem = 16px) */
  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;
}


/* ===========================================
 * 제목 (Headings)
 * ===========================================
 */

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);
}


/* ===========================================
 * 리스트 (Lists)
 * ===========================================
 */

ul, ol {
  list-style: none;
}

li {
  list-style: none;
}


/* ===========================================
 * 버튼 (Buttons)
 * ===========================================
 */

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;
}


/* ===========================================
 * 입력창 (Inputs)
 * ===========================================
 */

input,
textarea,
select {
  /* 기본 스타일 제거 */
  border: none;
  background: none;
  padding: 0;
  margin: 0;

  /* 폰트 상속 */
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;

  /* 포커스 아웃라인 제거 (접근성을 위해 나중에 추가) */
  outline: none;

  /* iOS 둥근 모서리 제거 */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;

  /* 탭 하이라이트 제거 (모바일) */
  -webkit-tap-highlight-color: transparent;
}

/* Placeholder 스타일 */
input::placeholder,
textarea::placeholder {
  color: var(--color-gray-400);
  opacity: 1;
}

/* 자동완성 배경색 제거 (Chrome) */
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 {
  /* 블록 요소로 변경 (inline 간격 제거) */
  display: block;

  /* 최대 너비 제한 (부모 요소 넘지 않음) */
  max-width: 100%;

  /* 비율 유지 */
  height: auto;
}

svg {
  /* SVG는 부모 색상 상속 가능 */
  fill: currentColor;
}


/* ===========================================
 * 테이블 (Tables)
 * ===========================================
 */

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;
}


/* ===========================================
 * 스크롤바 스타일 (선택사항)
 * ===========================================
 */

/* Chrome, Safari, Edge */
::-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);
}

/* Firefox */
* {
  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;
}


/* ===========================================
 * 접근성 (Accessibility)
 * ===========================================
 */

/* 키보드 포커스 표시 */
*: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;
  }
}
