/* ============================================================
   base.css — 토큰 · 리셋 · 유틸
   컨벤션(convention 스킬)의 구현체다. 페이지는 여기 정의된
   토큰·유틸을 쓰고 생값(하드코딩 px·생 clamp)을 쓰지 않는다.

   사이트마다 바꾸는 것: 토큰 값 (:root 블록)
   건드리지 않는 것:     유틸 클래스 정의, 리셋
   ============================================================ */

/* ── 웹폰트 로딩 ─────────────────────────────────────────────
   ⚠ 선언만 하고 로딩하지 않으면 전 페이지가 시스템 폰트로 렌더된다.
      실제로 있었던 가장 비싼 사고이고, 눈으로는 잘 안 보인다.
      → `node .claude/skills/measure/check.mjs <파일>` 로 반드시 확인할 것.

   woff2 파일을 `_shared/fonts/` 에 넣는다. 시안이 쓰는 굵기만 넣으면 된다.
   빠른 시작이 필요하면 아래 대신 각 페이지 <head> 에 CDN link 를 써도 되지만,
   납품물은 셀프호스트를 권장한다(오프라인·재현성).
   ─────────────────────────────────────────────────────────── */
@import url("fonts.css");   /* Noto Sans KR 400/500/700 · Outfit 400/500/600/700 — 셀프호스트(@fontsource), 시안 글꼴 */

:root {
  /* ── 글꼴 — 시안: 한글 Noto Sans KR · 영문/숫자 Outfit (site/tokens.md) ── */
  --font-ko:    "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --font-latin: "Outfit", "Noto Sans KR", system-ui, -apple-system, sans-serif;
  --font-num:   var(--font-latin);       /* 시안: 수치·번호는 Outfit */

  /* ── 크기 — 시안 최대값(1920) + 가독성 하한 ── */
  --fs-body:  clamp(15px, 0.95vw, 16px);   /* 시안 본문 16 (컨벤션 18 상한보다 시안 우선) */
  --fs-small: clamp(13px, 0.8vw, 14px);
  --fs-lead:  clamp(17px, 1.2vw, 20px);
  --fs-h3:    clamp(18px, 1.15vw, 20px);   /* 카드·블록 제목 20 */
  --fs-h2:    clamp(24px, 1.8vw, 30px);    /* 섹션 제목 30 */
  --fs-title: clamp(26px, 1.9vw, 32px);    /* 제품명 32 */
  --fs-h1:    clamp(32px, 2.6vw, 48px);    /* 서브비주얼 48 */

  /* ── 색 — Figma 변수 (01 Foundation) ── */
  --navy-900:  #0b1c45;
  --navy-700:  #15327e;
  --blue-500:  #2b63d9;
  --blue-100:  #eaf0fc;
  --green-600: #1e9b4b;
  --green-100: #e8f6ec;
  --gray-900:  #111827;
  --gray-700:  #374151;
  --gray-500:  #6b7280;
  --gray-300:  #d1d5db;
  --gray-200:  #e5e7eb;
  --gray-50:   #f5f7fa;
  --page:       #ffffff;
  --surface:    var(--gray-50);
  --text:       var(--gray-900);
  --text-soft:  var(--gray-700);
  --text-muted: var(--gray-500);
  --line:       var(--gray-200);
  --primary:    var(--navy-700);

  /* ── 여백 · 레일 — 시안 콘텐츠 폭 1400 (좌우 260 @1920) ── */
  --gutter: 100px;
  --rail:   1400px;
  --section-y: clamp(48px, 4.2vw, 80px);

  /* ── 모션 ── */
  --ease: cubic-bezier(.2, .7, .2, 1);
  --dur:  .32s;

  /* ── 터치 ── */
  --hit-min: 44px;
}

@media (max-width: 1600px) {
  :root { --gutter: 5vw; }
}

/* ── 리셋 ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  min-width: 320px;
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: var(--font-ko);
  font-size: var(--fs-body);
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;          /* 한글 단어 중간 개행 방지 */
}

img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { color: inherit; background: none; border: 0; cursor: pointer; }

/* ── 컨테이너 — 좌우 여백은 여기서만 소비한다 ────────────────
   페이지가 px 패딩을 직접 박지 않는다. */
.container,
.container--narrow,
.container--wide {
  margin-inline: auto;
}
.container         { width: min(var(--rail), calc(100% - var(--gutter) * 2)); }
.container--narrow { width: min(1200px,     calc(100% - var(--gutter) * 2)); }
.container--wide   { width: min(1800px,     calc(100% - var(--gutter) * 2)); }

/* ── 이미지 · 배경 · 썸네일 ──────────────────────────────────
   화면이 바뀌어도 찌그러지지 않게 항상 cover (비율 유지, 잘림 허용) */
.img-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.bg-cover {
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
}
.thumb {
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
  aspect-ratio: 4 / 3;           /* 페이지에서 override 가능 */
}

/* ── 타이포 유틸 ─────────────────────────────────────────── */
.lead        { font-family: var(--font-latin); font-size: var(--fs-lead); }
.num,
[data-num]   { font-family: var(--font-num); font-variant-numeric: tabular-nums; }

/* ── 시안 줄바꿈 보존 — 본문 단락용 ──────────────────────────
   시안(1920)의 <br> 을 본문 <p> 에 그대로 두면 다른 폭에서 고아 줄이 생긴다 (실제: 배치 5페이지 중 3페이지).
   본문 단락의 시안 줄바꿈은 <br class="br-wide"> 로 — 시안 폭 등급(xlarge ≥1600)에서만 살아난다.
   제목의 <br> 은 의미 있는 행 분리이므로 페이지가 따로 다룬다. */
.br-wide { display: none; }
@media (min-width: 1600px) { .br-wide { display: inline; } }

/* ── 접근성 ──────────────────────────────────────────────── */
.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;
}
:where(a, button, [tabindex]):focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ── 콘텐츠 높이 원칙 ─────────────────────────────────────────
   흐르는 텍스트 영역에 고정 height 를 박지 않는다.
   내용이 높이를 결정하고, 여백은 padding/margin 으로 만든다.
   고정 height 는 '내용이 흐르지 않는' 곳에만 —
   이미지 박스, 썸네일, 장식 요소.
   ─────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
