/* ============================================================
   base.css — 리셋 · 기본 타이포그래피 · 접근성 · 유틸리티
   ============================================================ */

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

* { margin: 0; }

html {
  /* 원본 유동 루트 폰트 공식 이식 — 375/768/1440px에서 정확히 16px */
  font-size: min(calc(4.2667vw - var(--sbw) * .042667), 20.3px);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
  overscroll-behavior: contain;
}

@media (min-width: 768px) {
  html { font-size: calc(2.0833vw - var(--sbw) * .020833); }
}

@media (min-width: 1024px) {
  html { font-size: min(calc(1.1111vw - var(--sbw) * .011111), 18.7px); }
}

body {
  min-height: 100svh;
  background-color: var(--bg-page);
  color: var(--fg-body);
  font-family: var(--font-sans);
  font-size: var(--t-16);
  font-weight: var(--fw-regular);
  line-height: var(--lh-snug);
  letter-spacing: .02em;
  /* 한국어는 어절 단위로 줄바꿈한다 (단어 중간 분리 방지) */
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body.is-locked { overflow: hidden; }

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

img { height: auto; }

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

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

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

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

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--fw-regular);
  line-height: var(--lh-none);
  color: var(--fg-heading);
  text-wrap: balance;
}

p { text-wrap: pretty; }

hr { border: 0; border-top: var(--bd-hairline); }

table { border-collapse: collapse; width: 100%; }

::selection { background: var(--c-gold); color: var(--c-dark); }

/* ---------- 포커스 ---------- */
:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

:focus:not(:focus-visible) { outline: none; }

/* ---------- 접근성 유틸 ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-links {
  position: absolute;
  inset-inline: 0;
  top: 0;
  z-index: var(--z-toast);
}

.skip-link {
  position: absolute;
  inset-inline-start: var(--sp-16);
  top: 0;
  transform: translateY(-120%);
  padding: var(--sp-12) var(--sp-20);
  background: var(--c-dark);
  color: var(--c-cream);
  font-size: var(--t-14);
  transition: transform var(--d-fast) var(--ease-quart-out);
}

.skip-link:focus-visible { transform: translateY(0); }

/* ---------- 타이포 역할 클래스 ---------- */
.t-display {
  font-size: var(--t-40);
  font-weight: var(--fw-light);
  line-height: var(--lh-none);
  letter-spacing: var(--tr-tightest);
  text-transform: uppercase;
}

.t-page-title {
  font-size: var(--t-32);
  font-weight: var(--fw-light);
  line-height: var(--lh-none);
  letter-spacing: var(--tr-tightest);
  text-transform: uppercase;
}

.t-section-title {
  font-size: var(--t-32);
  font-weight: var(--fw-light);
  line-height: var(--lh-none);
  letter-spacing: var(--tr-tightest);
  text-transform: uppercase;
}

.t-product-title {
  font-size: var(--t-24);
  font-weight: var(--fw-regular);
  line-height: var(--lh-none);
  letter-spacing: var(--tr-tighter);
  text-transform: uppercase;
}

.t-sub {
  font-size: var(--t-20);
  font-weight: var(--fw-regular);
  line-height: var(--lh-tight);
  letter-spacing: var(--tr-tight);
}

.t-eyebrow {
  font-size: var(--t-13);
  font-weight: var(--fw-medium);
  line-height: var(--lh-snug);
  letter-spacing: var(--tr-widest);
  text-transform: uppercase;
  color: var(--fg-muted);
}

.t-body { font-size: var(--t-16); line-height: var(--lh-snug); }
.t-body-lg { font-size: var(--t-18); line-height: var(--lh-relaxed); }
.t-caption { font-size: var(--t-14); color: var(--fg-muted); }
.t-legal { font-size: var(--t-12); color: var(--fg-subtle); }

@media (min-width: 1024px) {
  .t-page-title { font-size: var(--t-74); line-height: .9; letter-spacing: -.029em; }
  .t-section-title { font-size: var(--t-52); }
  .t-product-title { font-size: var(--t-32); }
  .t-sub { font-size: var(--t-24); }
}

/* ---------- 레이아웃 유틸 ---------- */
.container { padding-inline: var(--margin); }

.container--grid {
  width: var(--grid-width);
  margin-inline: auto;
}

.stack > * + * { margin-top: var(--flow, var(--sp-16)); }

.center-text { text-align: center; }

.measure { max-width: 46rem; margin-inline: auto; }

.bg-cream { background-color: var(--c-cream); }
.bg-ivory { background-color: var(--c-ivory); }
.bg-sand { background-color: var(--c-sand); }
.bg-beige { background-color: var(--c-beige); }

/* ---------- 스크롤 리빌 ---------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .9s var(--ease-quart-out), transform .9s var(--ease-quart-out);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ---------- 모션 감소 ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

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

  .reveal { opacity: 1; transform: none; }
}

/* ---------- 고대비 모드 ---------- */
@media (forced-colors: active) {
  .btn { border: 1px solid ButtonText; }
  .product-card__media { border: 1px solid CanvasText; }
}

/* ---------- 인쇄 ---------- */
@media print {
  .site-header,
  .site-footer,
  .cart-drawer,
  .announcement { display: none !important; }

  body { background: #fff; color: #000; }
}
