/*
 * layout.css — breakpoint / container / grid tokens.
 * 채널별로 분리한다: Product(app)는 mobile-first min-width, Website는 Webflow 고정 max-width.
 * CSS 변수는 @media 조건에 쓸 수 없다 — 아래 유틸리티 클래스가 유일한 정본이고,
 * 토큰은 JS·문서·디자인 툴이 같은 숫자를 참조하기 위한 SSOT다.
 */

:root {
  /* ===== Product / app — min-width, mobile-first ===== */
  --bp-sm: 640px;
  --bp-md: 768px;
  --bp-lg: 1024px;
  --bp-xl: 1280px;
  --bp-2xl: 1536px;

  /* ===== Website / Webflow — max-width, desktop-first (Webflow 고정값, 변경 불가) ===== */
  --bp-web-tablet: 991px;
  --bp-web-mobile-land: 767px;
  --bp-web-mobile-port: 479px;

  /* ===== Containers ===== */
  --container-product: 1200px;
  --container-product-narrow: 960px;
  --container-web: 1280px;
  --container-web-narrow: 960px;

  /* ===== Gutters ===== */
  --gutter-product: 24px;
  --gutter-product-sm: 16px;
  /* 라이브 `.padding-global` 실측(2026-08-21): 2.5rem, ≤767px 1.25rem.
     991px 구간 오버라이드는 없다 — 태블릿도 40px 그대로다.
     정본은 tokens/website.css Layer 4. 여기 값은 그걸 따라간다. */
  --gutter-web: 40px;
  --gutter-web-tablet: 40px;
  --gutter-web-mobile: 20px;

  /* ===== Grid ===== */
  --grid-columns: 12; /* @kind other */
  --grid-columns-tablet: 8; /* @kind other */
  --grid-columns-mobile: 4; /* @kind other */
  --grid-gap: 24px;
  --grid-gap-mobile: 16px;

  /* ===== Minimum hit target (WCAG 2.5.8 AA / 2.5.5 AAA) ===== */
  --hit-target-min: 24px;
  --hit-target-comfortable: 44px;
}

/* ===== Product container — mobile-first ===== */
.ds-container {
  width: 100%;
  margin-inline: auto;
  padding-inline: var(--gutter-product-sm);
  max-width: var(--container-product);
}
@media (min-width: 768px) { .ds-container { padding-inline: var(--gutter-product); } }

/* ===== Website container — desktop-first, Webflow 브레이크포인트에 맞춘다 ===== */
.ds-container--web {
  width: 100%;
  margin-inline: auto;
  max-width: var(--container-web);
  padding-inline: var(--gutter-web);
}
@media (max-width: 991px) { .ds-container--web { padding-inline: var(--gutter-web-tablet); } }
@media (max-width: 767px) { .ds-container--web { padding-inline: var(--gutter-web-mobile); } }

/* ===== 12 → 8 → 4 column grid ===== */
.ds-grid {
  display: grid;
  grid-template-columns: repeat(var(--grid-columns), minmax(0, 1fr));
  gap: var(--grid-gap);
}
@media (max-width: 991px) {
  .ds-grid { grid-template-columns: repeat(var(--grid-columns-tablet), minmax(0, 1fr)); }
}
@media (max-width: 767px) {
  .ds-grid { grid-template-columns: repeat(var(--grid-columns-mobile), minmax(0, 1fr)); gap: var(--grid-gap-mobile); }
}

/* ===== Card auto-grid (반응형 규칙: 카드는 개수가 아니라 최소폭으로 접는다) ===== */
.ds-autogrid { display: grid; gap: var(--grid-gap); grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
@media (max-width: 767px) { .ds-autogrid { grid-template-columns: 1fr; gap: var(--grid-gap-mobile); } }

/* ===== Stack helper ===== */
.ds-stack { display: flex; flex-direction: column; gap: var(--space-4); }

/* ===== Coarse pointer: 최소 히트 타깃 보장 ===== */
@media (pointer: coarse) {
  button, [role="button"], a[href], summary, [role="tab"], [role="menuitem"], [role="checkbox"], [role="switch"], [role="radio"] {
    min-height: var(--hit-target-comfortable);
  }
}
