/* ============================================================
   ticker.bullstory.io — base.css v1.0
   리셋 + 타이포그래피 + 다크 테마 기본 스타일

   의존성: tokens.css
   ============================================================ */

/* ─── 1. 리셋 ─── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  /* Lenis가 초기화되면 이 속성은 무시됨 */
}

/* Lenis 활성 시 html overflow 제어 */
html.lenis,
html.lenis body {
  height: auto;
}
.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}
.lenis.lenis-smooth [data-lenis-prevent] {
  overscroll-behavior: contain;
}
.lenis.lenis-stopped {
  overflow: hidden;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-relaxed);
  letter-spacing: var(--letter-normal);
  color: var(--text-dark-primary);
  background-color: var(--bg-dark);
  min-height: 100vh;
  overflow-x: hidden;
  /* Three.js 캔버스가 body 뒤에 위치 */
  position: relative;
}

/* ─── 2. 타이포그래피 ─── */

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-normal);
  letter-spacing: var(--letter-tight);
  color: var(--text-dark-primary);
}

h1 {
  font-size: var(--font-size-4xl);
  line-height: var(--line-height-tight);
  letter-spacing: -0.03em;
}

h2 {
  font-size: var(--font-size-3xl);
  line-height: var(--line-height-tight);
}

h3 {
  font-size: var(--font-size-2xl);
}

h4 {
  font-size: var(--font-size-xl);
}

h5 {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
}

h6 {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
}

p {
  margin-bottom: var(--space-md);
  color: var(--text-dark-secondary);
  line-height: var(--line-height-relaxed);
}

/* 히어로 디스플레이 텍스트 */
.display-text {
  font-size: var(--font-size-display);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  letter-spacing: -0.04em;
}

/* 그래디언트 텍스트 효과 — 히어로 제목에 사용 */
.gradient-text {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* 보조 텍스트 */
.text-secondary {
  color: var(--text-dark-secondary);
}

.text-muted {
  color: var(--text-dark-muted);
}

/* 모노스페이스 (코드, 수치) */
.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* 수치 표시 (재무 데이터) — tabular-nums로 정렬 */
.tabular {
  font-variant-numeric: tabular-nums;
}

/* ─── 3. 링크 ─── */

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

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

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

/* ─── 4. 리스트 ─── */

ul, ol {
  list-style: none;
}

/* ─── 5. 이미지/미디어 ─── */

img, svg, video, canvas {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

/* ─── 6. 폼 요소 리셋 ─── */

button, input, select, textarea {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ─── 7. 스크롤바 (다크 테마) ─── */

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

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-pill);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Firefox 스크롤바 */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

/* ─── 8. 선택 영역 (::selection) ─── */

::selection {
  background: var(--accent-soft);
  color: var(--text-dark-primary);
}

/* ─── 9. 유틸리티 ─── */

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

/* 페이지 컨테이너 — max-width 제한 + 좌우 패딩 */
.page-container {
  max-width: var(--page-max-width);
  margin: 0 auto;
  padding: 0 var(--page-padding);
}

/* Three.js 캔버스 컨테이너 — 전체 배경 고정 */
.canvas-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: var(--z-canvas);
  pointer-events: none;
}

/* 메인 콘텐츠 — 캔버스 위에 오버레이 */
.main-content {
  position: relative;
  z-index: var(--z-content);
}

/* 섹션 간격 */
.section {
  padding: var(--space-section) 0;
}

.section + .section {
  padding-top: var(--space-3xl);
}

/* ─── 10. 접근성 ─── */

/* focus-visible: 키보드 탐색 시에만 포커스 링 표시 */
:focus:not(:focus-visible) {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* prefers-reduced-motion 존중 */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ─── 11. 텍스트 구분선 ─── */

hr {
  border: none;
  border-top: var(--line-width) solid var(--line-dark);
  margin: var(--space-2xl) 0;
}

/* ─── 12. 코드 블록 ─── */

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-dark-input);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  color: var(--accent-color);
}

pre {
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  background: var(--bg-dark-elevated);
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  overflow-x: auto;
  border: var(--glass-border);
}

pre code {
  background: none;
  padding: 0;
  color: var(--text-dark-primary);
}
