/* 베이스라인 컴포넌트 — 브릿지·랜딩·이벤트·가상 서비스 공통
   규칙: 값은 토큰만 쓴다. 컴포넌트를 새로 만들기 전에 DESIGN.md 의 "컴포넌트 고르기"를 먼저 본다. */

@layer components {

/* ───────── 머리글 ─────────
   목적지가 하나면 링크도 하나다. 메뉴 4~5개 + 오른쪽 버튼 조합을 기본으로 깔지 않는다(LY4). */
.site-header { border-bottom: 1px solid var(--line-subtle); background: var(--bg-canvas); }
.site-header[data-sticky] { position: sticky; top: 0; z-index: var(--z-header); }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: var(--space-md); min-height: 56px; }
.site-header__logo { display: inline-flex; align-items: center; height: var(--control); text-decoration: none; }
.site-header__logo img, .site-header__logo svg { height: 22px; width: auto; }

/* ───────── 버튼 ─────────
   라벨은 누르면 일어나는 일을 쓴다. "지금 시작하기·더 알아보기"를 모든 버튼에 쓰지 않는다(KR3). */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-xs);
  min-height: var(--control); padding-inline: var(--space-lg);
  border-radius: var(--radius-control); border: 1px solid transparent;
  font-family: var(--type-label-family); font-size: var(--type-label-size); font-weight: var(--type-label-weight);
  line-height: var(--type-label-leading); letter-spacing: var(--type-label-tracking);
  text-decoration: none; white-space: nowrap; /* 라벨 두 줄 금지(CP14) */
  background: var(--action); color: var(--action-on);
  transition: background-color var(--motion-base) var(--motion-ease), border-color var(--motion-base) var(--motion-ease), color var(--motion-base) var(--motion-ease);
}
@media (hover: hover) { .btn:hover { background: var(--action-hover); } }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { background: var(--bg-sunken); color: var(--text-tertiary); cursor: not-allowed; transform: none; }

.btn--accent { background: var(--accent); color: var(--accent-on); }
@media (hover: hover) { .btn--accent:hover { background: var(--accent-hover); } }
.btn--outline { background: transparent; color: var(--text-primary); border-color: var(--line-default); }
@media (hover: hover) { .btn--outline:hover { background: var(--bg-sunken); border-color: var(--line-strong); } }
.btn--text { background: transparent; color: var(--text-primary); padding-inline: var(--space-2xs); min-height: var(--control-sm); text-decoration: underline; text-underline-offset: 0.25em; }
@media (hover: hover) { .btn--text:hover { background: transparent; text-decoration-thickness: 2px; } }
.btn[data-size="sm"] { min-height: var(--control-sm); padding-inline: var(--space-md); font-size: var(--type-label-sm-size); }
.btn[data-size="lg"] { min-height: var(--control-lg); padding-inline: var(--space-xl); }
.btn--block { display: flex; width: 100%; }

/* ───────── 첫 화면 ─────────
   높이는 내용 높이(LY2). 가운데 정렬 대신 한쪽으로 기운다(LY7). 첫 진입 연출은 여기 한 곳에만 둔다(MO2). */
.hero { padding-block: var(--section-tight) var(--section); }
.hero__title { max-width: 16em; }
.hero__lede { max-width: var(--measure); color: var(--text-secondary); }
.hero__actions { display: flex; flex-wrap: wrap; gap: var(--space-xs); margin-top: var(--space-xs); }

/* 영상·사진이 먼저 나오고 헤드라인이 아래. 광고에서 들어온 사람에게 광고 장면을 그대로 이어 보여 준다 */
.hero--media-first { padding-top: 0; }
.hero--media-first .media { margin-inline: calc(var(--gutter) * -1); border-radius: 0; }
@media (min-width: 640px) { .hero--media-first .media { margin-inline: 0; border-radius: var(--radius-media); } }

/* 글자만 크게. 사진이 없거나 사진보다 문장이 센 경우 */
.hero--statement .hero__title { max-width: 13em; }

.enter { animation: enter var(--motion-enter) var(--motion-ease) both; }
.enter[data-delay="1"] { animation-delay: 80ms; }
.enter[data-delay="2"] { animation-delay: 160ms; }
@keyframes enter { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ───────── 섹션 머리 ─────────
   제목 위 작은 라벨(eyebrow)은 기본 0개, 페이지당 2개까지(TY4). 영문 대문자 라벨 금지(KR2). */
.section-head { display: flex; flex-direction: column; gap: var(--space-sm); margin-bottom: var(--space-xl); max-width: 36em; }
.section-head p { color: var(--text-secondary); }
.eyebrow { font-size: var(--type-label-sm-size); font-weight: var(--type-label-sm-weight); color: var(--text-accent); }

/* ───────── 사진·영상 ─────────
   실제 사진만(AS1·AS2). 첫 화면 사진에는 loading="lazy" 를 붙이지 않는다(AS3). 가짜 브라우저·폰 테두리를 그리지 않는다(CP2). */
.media { overflow: hidden; border-radius: var(--radius-media); background: var(--bg-sunken); }
.media img, .media video { width: 100%; height: 100%; object-fit: cover; }
.media[data-ratio="4/5"] { aspect-ratio: 4 / 5; }
.media[data-ratio="1/1"] { aspect-ratio: 1; }
.media[data-ratio="16/9"] { aspect-ratio: 16 / 9; }
.media[data-ratio="3/4"] { aspect-ratio: 3 / 4; }
figure > figcaption { margin-top: var(--space-xs); font-size: var(--type-caption-size); line-height: var(--type-caption-leading); color: var(--text-secondary); }

/* ───────── 표면 ─────────
   표면은 영역당 하나. 표면 안에 표면을 넣지 않는다(LY3). 안쪽 모서리 = 바깥 모서리 − 안쪽 여백(CP7). */
.surface { background: var(--bg-surface); border: 1px solid var(--line-subtle); border-radius: var(--radius-surface); padding: var(--space-lg); }
.surface[data-pad="lg"] { padding: var(--space-xl); }
.surface--sunken { background: var(--bg-sunken); border-color: transparent; }

/* ───────── 장점 목록 ─────────
   아이콘 3열 카드(LY1) 대신 쓴다. 항목의 무게가 다르면 첫 항목을 크게(points__lead). 번호는 실제 순서가 있을 때만. */
.points { list-style: none; padding: 0; display: grid; border-top: 1px solid var(--line-default); }
.points > li { display: grid; gap: var(--space-xs); padding-block: var(--space-lg); border-bottom: 1px solid var(--line-subtle); }
.points > li > h3 { font-size: var(--type-title-3-size); line-height: var(--type-title-3-leading); letter-spacing: var(--type-title-3-tracking); font-weight: var(--type-title-3-weight); }
.points > li > p { color: var(--text-secondary); max-width: var(--measure); }
.points > li.points__lead { padding-block: var(--space-xl); }
.points > li.points__lead > h3 { font-family: var(--type-title-2-family); font-size: var(--type-title-2-size); line-height: var(--type-title-2-leading); letter-spacing: var(--type-title-2-tracking); }
@media (min-width: 768px) {
  .points > li { grid-template-columns: 5fr 7fr; gap: var(--space-xl); align-items: baseline; }
}

/* ───────── 가격 ─────────
   정가 취소선은 실제로 그 값에 판 적이 있을 때만(s 태그). 조건은 가격 바로 아래에 같은 크기 체계로 쓴다. */
.price { display: grid; gap: var(--space-xs); }
.price__label { font-size: var(--type-label-sm-size); font-weight: var(--type-label-sm-weight); color: var(--text-secondary); }
.price__row { display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--space-xs); }
.price__amount { font-family: var(--type-price-family); font-size: var(--type-price-size); line-height: var(--type-price-leading); letter-spacing: var(--type-price-tracking); font-weight: var(--type-price-weight); font-variant-numeric: tabular-nums; }
.price__unit { font-size: var(--type-body-size); font-weight: 600; }
.price__was { color: var(--text-tertiary); font-size: var(--type-body-sm-size); }
.price__rate { color: var(--text-accent); font-weight: 700; font-variant-numeric: tabular-nums; }
.price__terms { list-style: none; padding: 0; display: grid; gap: var(--space-2xs); font-size: var(--type-body-sm-size); color: var(--text-secondary); }

/* ───────── 사양·비교 ───────── */
.spec { display: grid; grid-template-columns: max-content 1fr; column-gap: var(--space-lg); border-top: 1px solid var(--line-default); }
.spec > dt, .spec > dd { padding-block: var(--space-sm); border-bottom: 1px solid var(--line-subtle); }
.spec > dt { color: var(--text-secondary); font-size: var(--type-body-sm-size); }
.spec > dd { font-variant-numeric: tabular-nums; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.compare { width: 100%; min-width: 480px; border-collapse: collapse; font-size: var(--type-body-sm-size); }
.compare th, .compare td { padding: var(--space-sm) var(--space-md); text-align: left; border-bottom: 1px solid var(--line-subtle); vertical-align: top; }
.compare thead th { font-weight: 600; color: var(--text-secondary); border-bottom-color: var(--line-default); }
.compare [data-highlight] { background: var(--accent-soft); font-weight: 600; }

/* ───────── 단계 ───────── 실제로 순서가 있는 절차에만(LY8). */
.steps { list-style: none; padding: 0; counter-reset: step; display: grid; gap: var(--space-lg); }
.steps > li { counter-increment: step; display: grid; grid-template-columns: var(--control-sm) 1fr; column-gap: var(--space-md); }
.steps > li::before {
  content: counter(step); grid-row: span 2; display: grid; place-items: center;
  width: var(--control-sm); height: var(--control-sm); border-radius: var(--radius-full);
  border: 1px solid var(--line-strong); font-family: var(--font-numeric); font-weight: 700; font-variant-numeric: tabular-nums;
}
.steps > li > strong { font-size: var(--type-title-3-size); line-height: var(--control-sm); }
.steps > li > p { color: var(--text-secondary); }

/* ───────── 자주 묻는 질문 ───────── 스크립트 없이 details 로 연다 */
.faq { border-top: 1px solid var(--line-default); }
.faq details { border-bottom: 1px solid var(--line-subtle); }
.faq summary {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-md);
  min-height: var(--control-lg); padding-block: var(--space-md); cursor: pointer; list-style: none;
  font-weight: 600;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; flex: none; width: 10px; height: 10px; margin-right: var(--space-2xs);
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-3px); transition: transform var(--motion-base) var(--motion-ease);
}
.faq details[open] summary::after { transform: rotate(-135deg) translateY(-3px); }
.faq details > div { padding-bottom: var(--space-lg); color: var(--text-secondary); max-width: var(--measure); }

/* ───────── 후기 ─────────
   실제 후기만. 작성일·구매 옵션·출처를 붙인다. 자동으로 넘어가는 슬라이더 대신 손으로 미는 가로 목록(MO4). */
.reviews { display: grid; grid-auto-flow: column; grid-auto-columns: min(84%, 360px); gap: var(--space-md);
  overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: var(--space-xs); scrollbar-width: thin; }
.reviews > * { scroll-snap-align: start; }
.review { display: grid; gap: var(--space-sm); align-content: start; background: var(--bg-surface); border: 1px solid var(--line-subtle); border-radius: var(--radius-surface); padding: var(--space-lg); }
.review blockquote { font-size: var(--type-body-size); line-height: var(--type-body-leading); }
.review footer { font-size: var(--type-caption-size); color: var(--text-secondary); display: flex; flex-wrap: wrap; gap: var(--space-2xs) var(--space-sm); }
.review .media { border-radius: calc(var(--radius-surface) - var(--space-lg) + var(--space-xs)); }

/* ───────── 숫자 근거 ─────────
   출처 없는 큰 숫자는 쓰지 않는다(LY6). proof__source 가 비어 있으면 검사 스크립트가 잡는다. */
.proof { display: grid; gap: var(--space-2xs); }
.proof__value { font-family: var(--font-numeric); font-size: var(--type-title-1-size); line-height: 1.1; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.proof__label { font-weight: 600; }
.proof__source { font-size: var(--type-caption-size); color: var(--text-secondary); }

/* ───────── 이벤트 기간·쿠폰·유의사항 ───────── */
.period { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs) var(--space-sm); font-variant-numeric: tabular-nums; }
.badge {
  display: inline-flex; align-items: center; gap: var(--space-2xs); height: 26px; padding-inline: var(--space-xs);
  border-radius: var(--radius-xs); border: 1px solid var(--line-default);
  font-size: var(--type-caption-size); font-weight: 600; white-space: nowrap;
}
.badge[data-state="live"]::before { content: ""; width: 6px; height: 6px; border-radius: var(--radius-full); background: var(--positive); }
.badge[data-state="live"] { color: var(--positive); border-color: currentColor; }
.badge[data-state="ended"] { color: var(--text-tertiary); }

.coupon { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: var(--space-md);
  padding: var(--space-lg); border: 1px solid var(--line-strong); border-radius: var(--radius-surface); background: var(--bg-surface); }
.coupon__value { font-family: var(--font-numeric); font-size: var(--type-title-1-size); font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.coupon__terms { grid-column: 1 / -1; padding-top: var(--space-sm); border-top: 1px dashed var(--line-default); font-size: var(--type-caption-size); color: var(--text-secondary); }

.notice { font-size: var(--type-body-sm-size); color: var(--text-secondary); }
.notice h2, .notice h3 { font-size: var(--type-label-size); font-weight: 600; color: var(--text-primary); margin-bottom: var(--space-sm); }
.notice ul { padding-left: 1.1em; display: grid; gap: var(--space-2xs); }

/* ───────── 입력 ───────── */
.field { display: grid; gap: var(--space-xs); }
.field__label { font-size: var(--type-label-sm-size); font-weight: 600; }
.field__label [data-required]::after { content: " (필수)"; color: var(--text-secondary); font-weight: 450; }
.field__hint { font-size: var(--type-caption-size); color: var(--text-secondary); }
.field__error { font-size: var(--type-caption-size); color: var(--negative); font-weight: 600; }
.input, .select, .textarea {
  width: 100%; min-height: var(--control); padding: 0 var(--space-md);
  background: var(--bg-surface); border: 1px solid var(--line-default); border-radius: var(--radius-control);
  font-size: 16px; /* 16px 아래면 iOS 가 확대한다 */
  transition: border-color var(--motion-fast) var(--motion-ease);
}
.textarea { padding-block: var(--space-sm); min-height: 120px; resize: vertical; }
@media (hover: hover) { .input:hover, .select:hover, .textarea:hover { border-color: var(--text-tertiary); } }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--line-strong); }
.input[aria-invalid="true"], .select[aria-invalid="true"] { border-color: var(--negative); }
.input::placeholder { color: var(--text-tertiary); }

/* 개인정보 동의. 필수와 선택을 나누고, 선택 항목을 미리 체크하지 않는다 */
.consent { display: grid; gap: var(--space-2xs); border: 1px solid var(--line-subtle); border-radius: var(--radius-surface); padding: var(--space-sm) var(--space-md); }
.consent__all { padding-bottom: var(--space-xs); margin-bottom: var(--space-2xs); border-bottom: 1px solid var(--line-subtle); font-weight: 600; }
.check { display: flex; align-items: center; gap: var(--space-sm); min-height: var(--control-sm); cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--action); flex: none; }
.check a { margin-left: auto; font-size: var(--type-caption-size); color: var(--text-secondary); }

/* ───────── 하단 고정 행동 막대 ─────────
   모바일 커머스의 주 행동. 페이지에 하나만. 본문 끝이 가려지지 않게 body 에 has-cta-bar 를 붙인다. */
.cta-bar {
  position: fixed; inset: auto 0 0 0; z-index: var(--z-cta-bar);
  background: var(--bg-surface); border-top: 1px solid var(--line-subtle);
  padding: var(--space-xs) var(--gutter) calc(var(--space-xs) + env(safe-area-inset-bottom));
}
.cta-bar__inner { display: flex; align-items: center; gap: var(--space-md); max-width: var(--column); margin-inline: auto; }
.cta-bar__summary { display: grid; line-height: 1.3; min-width: 0; }
.cta-bar__summary small { font-size: var(--type-caption-size); color: var(--text-secondary); }
.cta-bar__summary strong { font-family: var(--font-numeric); font-variant-numeric: tabular-nums; font-size: var(--type-title-3-size); }
.cta-bar .btn { flex: 1; min-height: var(--cta-bar); }
body.has-cta-bar { padding-bottom: calc(var(--cta-bar) + var(--space-xl) + env(safe-area-inset-bottom)); }

/* ───────── 바닥글 ─────────
   한국 사업자 법정 표기가 먼저다(KR1). 실제 있는 페이지 링크만 한 줄로. 없는 사이트맵 4열 금지(LY5). */
.site-footer { padding-block: var(--space-3xl) var(--space-4xl); border-top: 1px solid var(--line-subtle); font-size: var(--type-caption-size); color: var(--text-secondary); }
.site-footer__links { display: flex; flex-wrap: wrap; gap: var(--space-2xs) var(--space-md); margin-bottom: var(--space-md); color: var(--text-primary); font-weight: 600; }
.site-footer__links a { text-decoration: none; }
.site-footer__links a[data-privacy] { font-weight: 700; } /* 개인정보처리방침은 다른 링크와 구분되게 */
.biz { display: flex; flex-wrap: wrap; gap: 0 var(--space-sm); line-height: 1.9; }
.biz > div { display: inline-flex; gap: var(--space-2xs); }
.biz dt::after { content: ""; }
.biz dd { margin: 0; font-variant-numeric: tabular-nums; }

/* ═════════ 가상 서비스(앱처럼 쓰는 웹) ═════════ */
.app { max-width: 480px; min-height: 100dvh; /* check-allow: LY2 앱 화면 틀은 첫 화면이 아니라 화면 전체를 채우는 틀이다 */ margin-inline: auto; background: var(--bg-canvas); display: flex; flex-direction: column; }
@media (min-width: 520px) { .app { border-inline: 1px solid var(--line-subtle); } }
.app__body { flex: 1; padding: var(--space-md) var(--gutter) var(--space-3xl); }

.app-bar { position: sticky; top: 0; z-index: var(--z-header); display: grid; grid-template-columns: var(--control) 1fr var(--control);
  align-items: center; min-height: 56px; padding-inline: var(--space-2xs); background: var(--bg-canvas); border-bottom: 1px solid var(--line-subtle); }
.app-bar__title { text-align: center; font-weight: 600; font-size: var(--type-label-size); }
.icon-btn { display: grid; place-items: center; width: var(--control); height: var(--control); border-radius: var(--radius-full); color: var(--text-primary); }
@media (hover: hover) { .icon-btn:hover { background: var(--bg-sunken); } }
.icon-btn svg { width: 22px; height: 22px; }

/* 탭 막대는 목적지 3~5개. 아이콘만 두지 않고 글자를 붙인다 */
.tab-bar { position: sticky; bottom: 0; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--bg-surface); border-top: 1px solid var(--line-subtle); padding-bottom: env(safe-area-inset-bottom); }
.tab-bar a { display: grid; justify-items: center; gap: 2px; padding-block: var(--space-xs); min-height: 56px; text-decoration: none;
  font-size: 11px; font-weight: 600; color: var(--text-tertiary); }
.tab-bar a svg { width: 22px; height: 22px; }
.tab-bar a[aria-current="page"] { color: var(--text-primary); }

.list { list-style: none; padding: 0; }
.list-item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--space-md); min-height: 64px; padding-block: var(--space-sm);
  border-bottom: 1px solid var(--line-subtle); text-decoration: none; }
.list-item__title { font-weight: 600; }
.list-item__meta { font-size: var(--type-caption-size); color: var(--text-secondary); }
.list-item__trail { font-family: var(--font-numeric); font-variant-numeric: tabular-nums; font-weight: 600; }
.avatar { width: 40px; height: 40px; border-radius: var(--radius-full); background: var(--bg-sunken); display: grid; place-items: center; font-weight: 700; font-size: var(--type-label-sm-size); }

.chips { display: flex; gap: var(--space-xs); overflow-x: auto; scrollbar-width: none; padding-block: var(--space-2xs); }
.chip { flex: none; height: var(--control-sm); padding-inline: var(--space-md); border-radius: var(--radius-full); border: 1px solid var(--line-default);
  font-size: var(--type-label-sm-size); font-weight: 600; white-space: nowrap; background: var(--bg-surface); }
.chip[aria-pressed="true"] { background: var(--action); color: var(--action-on); border-color: var(--action); }

.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: var(--space-2xs); background: var(--bg-sunken); border-radius: var(--radius-control); }
.segmented button { min-height: calc(var(--control) - var(--space-xs)); border-radius: calc(var(--radius-control) - var(--space-2xs)); font-weight: 600; font-size: var(--type-label-sm-size); color: var(--text-secondary); }
.segmented button[aria-pressed="true"] { background: var(--bg-surface); color: var(--text-primary); box-shadow: var(--shadow-1); }

/* 바텀시트. <dialog class="sheet"> 를 showModal() 로 연다 */
.sheet { margin: auto auto 0; width: 100%; max-width: 480px; max-height: 85dvh; padding: var(--space-lg) var(--gutter) calc(var(--space-lg) + env(safe-area-inset-bottom));
  border: 0; border-radius: var(--radius-xl) var(--radius-xl) 0 0; background: var(--bg-surface); color: var(--text-primary); box-shadow: var(--shadow-3); }
.sheet::backdrop { background: var(--scrim); }
.sheet[open] { animation: sheet-in var(--motion-slow) var(--motion-ease); }
.sheet__grip { width: 36px; height: 4px; border-radius: var(--radius-full); background: var(--line-default); margin: calc(var(--space-xs) * -1) auto var(--space-md); }
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

.toast { position: fixed; left: 50%; bottom: calc(var(--space-3xl) + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: var(--z-toast);
  max-width: calc(100% - var(--gutter) * 2); padding: var(--space-sm) var(--space-lg); border-radius: var(--radius-control);
  background: var(--bg-inverse); color: var(--text-inverse); font-size: var(--type-body-sm-size); font-weight: 600; box-shadow: var(--shadow-2); }
.toast[hidden] { display: none; }

.empty { display: grid; justify-items: start; gap: var(--space-sm); padding-block: var(--space-3xl); }
.empty p { color: var(--text-secondary); }

.skeleton { background: var(--bg-sunken); border-radius: var(--radius-sm); min-height: 1em; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }

.meter { height: 8px; border-radius: var(--radius-full); background: var(--bg-sunken); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--action); border-radius: inherit; }
}
