/* ==========================================================================
   K-POP Timeline - Base Styles
   ========================================================================== */

/* ===== Multi-Language Font System (Unicode-range) ===== */
@font-face {
  font-family: 'Multi-Language';
  src: local('Geist'), local('Geist-Regular');
  unicode-range: U+0000-007F, U+2000-206F; /* Basic Latin + General Punctuation */
}

@font-face {
  font-family: 'Multi-Language';
  src: local('Noto Sans JP'), local('NotoSansJP-Regular');
  unicode-range: U+3000-30FF, U+4E00-9FFF, U+FF00-FFEF; /* Hiragana, Katakana, CJK, Fullwidth */
}

@font-face {
  font-family: 'Multi-Language';
  src: local('Noto Sans KR'), local('NotoSansKR-Regular');
  unicode-range: U+AC00-D7AF, U+1100-11FF; /* Hangul Syllables + Jamo */
}

/* ===== Reset ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family-ja);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-normal);
  color: var(--color-text-primary);
  background-color: var(--color-bg-primary);
  overflow-x: hidden;
}

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

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

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

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

/* ===== Images ===== */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ===== Lists ===== */
ul, ol {
  list-style: none;
}

/* ===== Buttons ===== */
button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* ===== Focus Styles ===== */
:focus-visible {
  outline: 2px solid var(--color-accent-primary);
  outline-offset: 2px;
}

/* ===== Selection ===== */
::selection {
  background-color: var(--color-accent-light);
  color: var(--color-text-primary);
}

/* ===== Utility Classes ===== */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-ja {
  font-family: var(--font-family-ja);
  font-feature-settings: 'palt' 1;
}

.text-ko {
  font-family: var(--font-family-ko);
  color: var(--color-text-korean);
}

.text-en {
  font-family: var(--font-family-en);
}

.text-accent {
  color: var(--color-accent-primary);
}

/* ===== Palt Typesetting Integration ===== */
/* Latin text within Japanese (automatically applied by palt-typesetting library) */
.typesetting-latin {
  font-family: var(--font-family-en);
  font-feature-settings: normal;
}

/* Thin space between Japanese and Latin characters */
.typesetting-thin-space {
  display: inline;
  font-size: 0.25em;
}

/* ===== Container ===== */
.container {
  width: 100%;
  max-width: var(--max-width-content);
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
}

/* ===== Loading State ===== */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  gap: var(--spacing-md);
}

.loading__spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--color-bg-secondary);
  border-top-color: var(--color-accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading__text {
  color: var(--color-text-secondary);
  font-size: var(--font-size-meta);
}

.loading__progress {
  width: 200px;
  height: 4px;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.loading__progress-bar {
  height: 100%;
  background: var(--color-accent-primary);
  transition: width var(--transition-normal);
}

.loading--hidden {
  opacity: 0;
  transition: opacity 0.3s ease-out;
  pointer-events: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}
