/* ==========================================================
   base.css - 기본 스타일 (초기화, 글자, 공통 레이아웃)
   ========================================================== */

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

* {
  margin: 0;
}

html {
  background: var(--paper); /* 완전한 흰색. 장식 레이어 없이 그대로 */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-gutter: stable; /* 메뉴를 열어 스크롤을 잠가도 스크롤바 자리가 그대로라 페이지가 다시 배치되지 않음 */
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--space-4));
  scrollbar-color: rgb(29 31 35 / 0.28) transparent;
  scrollbar-width: thin;
}

body {
  min-height: 100vh;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-base);
  font-size: var(--text-body-m);
  line-height: var(--lh-body);
  letter-spacing: var(--tracking-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* 한국어는 단어 단위로 줄바꿈, 일본어는 문장 부호 규칙을 엄격하게 */
/* lang 속성이 붙은 요소 단위로도 적용 (예: 영어 페이지 안의 한국어 문단) */
:lang(ko) {
  word-break: keep-all;
  overflow-wrap: break-word;
}

:lang(ja) {
  word-break: normal;
  line-break: strict;
  overflow-wrap: break-word;
}

:lang(en) {
  word-break: normal;
}

/* 일본어 제목은 어절(문절) 단위로 줄바꿈 (지원 브라우저에서) */
:lang(ja) :is(h1, h2, h3, h4) {
  word-break: auto-phrase;
}

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

a {
  color: inherit;
  text-decoration: none;
}

/* 영문 대문자 표기: 제목 · 버튼 · 링크 · 라벨 · 숫자 등 화면의 영어는 모두 대문자.
   문장(문단 · 설명 · 표 설명)과 메일 주소 · 입력창은 읽기 쉽게 원래 대소문자 그대로 (한글 · 일본어에는 영향 없음) */
body {
  text-transform: uppercase;
}

p,
dd,
blockquote,
input,
textarea,
select,
option,
a[href^="mailto:"],
a[href^="tel:"],
.svc-sum,
.footer-mail {
  text-transform: none;
}

/* 문단 클래스지만 제목 역할인 것 */
.story-line {
  text-transform: uppercase;
}

/* 영어 글자체는 Newsreader Display ExtraLight(200) 한 굵기만 불러오므로, 더 굵은 굵기를 요청해도 억지로 두껍게 만들지 않음 */
html {
  font-synthesis-weight: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

ul,
ol {
  list-style: none;
  padding: 0;
}

h1,
h2,
h3,
h4 {
  font-weight: 500;
  line-height: var(--lh-heading);
  letter-spacing: var(--tracking-heading);
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

/* ----- 브라우저 기본 요소도 디자인에 맞춤 ----- */
::selection {
  background: var(--selection);
  color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 4px;
}

main:focus {
  outline: none;
}

::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-thumb {
  background: rgb(29 31 35 / 0.22);
  border: 3px solid var(--paper);
  border-radius: var(--radius-full);
}

/* hidden 속성은 어떤 배치 규칙보다 우선 (스크립트가 숨긴 줄이 다시 보이지 않게) */
[hidden] {
  display: none !important;
}

/* ----- 공통 레이아웃 ----- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  position: relative;
  padding-block: var(--section-y);
}

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

.skip-link {
  position: fixed;
  top: var(--space-3);
  left: var(--space-3);
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius-full);
  transform: translateY(-160%);
  transition: transform var(--dur-2) var(--ease-out);
}

.skip-link:focus-visible {
  transform: none;
}

/* 줄바꿈 표시(\n)가 있는 번역 문구를 줄 단위로 감쌀 때 사용 */
.line {
  display: block;
}

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

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