/* =========================================================
   Metropy — Base Styles
   Reset, Scrollbar, Body, Typography, Accessibility
   ========================================================= */

* { margin:0; padding:0; box-sizing:border-box; }

html { scroll-behavior: smooth; }

/* ───── Custom Scrollbar ───── */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--surface2);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb {
  background: var(--surface3);
  border-radius: 5px;
  border: 2px solid var(--surface2);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--surface3) var(--surface2);
}

body {
  font-family: 'Noto Sans KR', -apple-system, 'Malgun Gothic', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* ───── 접근성 개선 ───── */

/* Skip to content */
.skip-to-content {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  padding: 12px 24px;
  background: var(--accent);
  color: var(--bg);
  font-weight: 700;
  font-size: .95rem;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  text-decoration: none;
  transition: top .2s ease;
}

.skip-to-content:focus {
  top: 0;
}

/* Focus visible */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* Remove default outline for mouse clicks */
:focus:not(:focus-visible) {
  outline: none;
}

/* ARIA live region (for screen readers) */
.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;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .spinner {
    animation: none;
    border: 4px solid var(--accent);
  }
}

/* ───── 노치·홈 인디케이터 대응 ─────
   viewport-fit=cover 를 켜면 콘텐츠가 화면 끝까지 퍼지므로
   안전영역만큼 안쪽으로 물려줘야 한다. 안 하면 아이폰에서
   좌우가 노치에, 하단이 홈 인디케이터에 가린다. */
body {
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

.navbar {
  padding-top: env(safe-area-inset-top, 0px);
}

/* 하단 고정 요소는 각자 env() 를 더한다. 여기서는 페이지 끝 여백만. */
#main-content {
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
