/* ==========================================================================
   match.css — 맞춤 찾기 위저드(/match/*)와 **홈 상단 진입 블록**의 전용 스타일.

   컴파일된 Tailwind 번들은 JIT 산출물이라 없는 클래스는 조용히 무효다. 위저드가
   필요로 하는데 번들에 없는 것만 여기 순수 CSS 로 적는다 — 값은 design.md 토큰
   변수(`--gold-deep`·`--bone`·`--border`·`--foreground`·`--muted-foreground`·`--card`·
   `--background`·`--font-display`)만 쓰고 색을 새로 짓지 않는다.

   시각 정본은 W2 시안 보드(`05_홈페이지/design-board/` 의 H-A·W1~W3·R1·R0 프레임과
   board.css B~E 절)다. 보드의 `bd-*` 수식어를 여기 `bn-*` 로 옮긴 것이고, 보드에만
   있던 장치(기기 프레임·safe-area 흉내 막대·주석 카드)는 옮기지 않았다.

   여기 있는 클래스는 `match-html.test.ts`·`index-html.test.ts` 의 class-audit 대상이다.

    0. 모션 토큰        1. 선택지 카드     4. 직접 입력
    5. 조건 요약 칩     6. 단계 전환       7. CTA 모바일 치수
    8. 하단 고정 바     9. 홈 진입(H 안 A) 10. 위저드 히어로·위쪽 줄
   11. 결과             12. 제목 포커스 링

   모션의 시간·곡선·거리·순서는 트랙 C 스펙(C1~C9)의 값이고, 9994 `flow-motion.tsx` 에서
   왔다. 색·라운드는 가져오지 않았다. 원칙: 위치는 튕기지 않는다, 크기만 5% 안에서 넘친다.
   `transform`·`opacity`·`filter`(글자 블록만)만 움직인다. `height`·`box-shadow` 는 움직이지
   않는다(선택 글로우는 켜고 끄기만 한다).

   **전환점은 1023/1024 다**(W2 · UX-23·UX-14, 2026-09-21). 전에는 767/768 이라 태블릿
   (768×1024)이 데스크톱 배치로 넘어갔고, 거기서 히어로 461px + 흐름 안의 바 때문에
   「다음」이 첫 화면 밖이었으며 상시 FAB 가 선택지를 가렸다. 태블릿은 손으로 쥐는 화면이다 —
   하단 고정 바·위쪽 줄 고정·FAB 숨김을 1023 까지 쓴다. 팝업(`listing-modal.css`)도
   같은 자리에서 같은 판단을 한다.
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. `hidden` 이 곧 숨김이다. 아래 규칙들이 `display` 를 다시 지정하므로, 속성 하나가
      언제나 이긴다고 못 박는다 — 안 그러면 `match.js` 가 숨긴 바가 데스크톱에서만
      다시 나타난다(`custom.css` 의 `.he-modal [hidden]` 과 같은 이유).
   -------------------------------------------------------------------------- */
#bn-match [hidden] {
  display: none !important;
}

/* 모션 토큰(C1). 이 스코프 밖에서 쓰지 않는다. */
#bn-match {
  --bn-snap: cubic-bezier(0.831, 0.063, 0.382, 1.004); /* 상태가 바뀌거나 빠질 때 */
  --bn-grow: cubic-bezier(0.694, 0.152, 0.077, 0.927); /* 진행 막대·자리 이동 */
  --bn-expo: cubic-bezier(0.16, 1, 0.3, 1); /* 등장 도착 */
}

/* --------------------------------------------------------------------------
   1. 선택지 카드 — 한 줄 배치(라벨 · 부제 · 건수 · 체크). 눌림 상태는 `aria-pressed`
      속성이 정본이다(클래스를 따로 갈아끼우지 않는다 — 두 곳이 갈라지면 스크린리더가 읽는
      상태와 보이는 상태가 달라진다). 시작 화면의 링크 선택지는 `data-chosen` 이 같은 일을
      한다(링크에는 `aria-pressed` 가 없다).
   -------------------------------------------------------------------------- */
.bn-match-choices[class] {
  grid-template-columns: minmax(0, 1fr);
}

/* 번들의 `.press` 는 호버에 2px 떠오른다 — 선택지는 위치가 움직이지 않는다(C1).
   특이도를 한 칸 올려 스타일시트 순서와 무관하게 이긴다. */
.bn-match-choice[class] {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  /* 놓을 때 300ms 로 돌아오고, 색은 끌 때 230ms 선형이다. 켤 때 값은 아래 상태에서 준다.
     opacity·filter 는 형제 물러남(§1 끝)의 값이다. */
  transition:
    transform 300ms var(--bn-expo),
    border-color 230ms linear,
    background-color 230ms linear,
    color 230ms linear,
    opacity 170ms linear,
    filter 170ms linear;
}

.bn-match-choice[class]:hover {
  transform: none;
}

.bn-match-choice[class]:active {
  transform: scale(0.97);
  transition-duration: 120ms, 230ms, 230ms, 230ms, 170ms, 170ms;
  transition-timing-function: var(--bn-snap), linear, linear, linear, linear, linear;
}

.bn-match-choice[aria-pressed="true"],
.bn-match-choice[data-chosen="true"] {
  border-color: color-mix(in oklab, var(--gold-deep) 78%, black);
  background-color: var(--gold-deep);
  color: var(--bone);
  /* 글로우는 켜고 끄기만 한다(C1). */
  box-shadow: 0 0 18px color-mix(in oklab, var(--gold-deep) 38%, transparent);
  transition-duration: 300ms, 170ms, 170ms, 170ms, 170ms, 170ms;
}

/* 글로우가 번들의 포커스 링(box-shadow)을 덮으므로 고른 칸은 윤곽선으로 포커스를 그린다. */
.bn-match-choice[aria-pressed="true"]:focus-visible {
  outline: 2px solid var(--gold-deep);
  outline-offset: 2px;
}

/* 라벨이 왼쪽 끝을 맡고 나머지는 오른쪽으로 모인다 — 서로 밀지 않는다. */
.bn-match-choice-label[class] {
  margin-right: auto;
  line-height: 1.35;
  font-weight: 500;
}

.bn-match-choice-sub {
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

/* C5 — 이 선택지를 고르면 남는 수. */
.bn-match-count {
  flex: none;
  font-size: 0.875rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* 0건은 흐리되 누를 수 있다 — 누르면 「정확히 맞는 매물은 없어요」와 가까운 매물이 나온다. */
.bn-match-choice[data-empty="true"] .bn-match-choice-label,
.bn-match-choice[data-empty="true"] .bn-match-choice-sub,
.bn-match-choice[data-empty="true"] .bn-match-count {
  color: var(--muted-foreground);
}

/* 크림슨 면 위에서는 부제·건수도 **불투명 bone** 이다. 반투명(80%)으로 두면 14px 글자의
   대비가 4.04:1 로 AA(4.5:1) 아래로 내려간다 — 부제는 장식이 아니라 판정에 쓰는 평 구간이다. */
.bn-match-choice[aria-pressed="true"] .bn-match-choice-label,
.bn-match-choice[aria-pressed="true"] .bn-match-choice-sub,
.bn-match-choice[aria-pressed="true"] .bn-match-count,
.bn-match-choice[data-chosen="true"] .bn-match-count {
  color: var(--bone);
}

/* 체크는 자리를 늘 잡아 둔다 — 고른 순간 건수가 옆으로 밀리지 않게. */
.bn-match-check {
  flex: none;
  width: 20px;
  height: 20px;
  visibility: hidden;
}

.bn-match-choice[aria-pressed="true"] .bn-match-check,
.bn-match-choice[data-chosen="true"] .bn-match-check {
  visibility: visible;
  animation:
    bn-match-check-pop 400ms backwards,
    bn-match-fade 160ms var(--bn-expo) backwards;
}

@keyframes bn-match-check-pop {
  0% {
    transform: scale(0.6);
    animation-timing-function: var(--bn-expo);
  }
  40% {
    transform: scale(1.05);
    animation-timing-function: var(--bn-grow);
  }
  100% {
    transform: scale(1);
  }
}

/* 자동 진행을 기다리는 250ms 동안 나머지 선택지가 물러난다(C3). */
.bn-match-panel[data-advancing="true"] .bn-match-choice[aria-pressed="false"],
.bn-match-panel[data-advancing="true"] .bn-match-choice:not([aria-pressed]):not([data-chosen]) {
  opacity: 0.6;
  filter: blur(1px);
}

.bn-match-q[class] {
  font-weight: 500;
  letter-spacing: -0.02em;
  word-break: keep-all;
  text-wrap: balance;
}

@media (max-width: 1023px) {
  .bn-match-choices {
    margin-top: 18px;
    gap: 10px;
  }

  /* Tailwind `p-5`(20px)보다 한 칸 높은 특이도 — 스타일시트 순서와 무관하게 이긴다. */
  .bn-match-choice[class] {
    padding: 10px 16px;
  }
}

/* --------------------------------------------------------------------------
   4. 직접 입력 칸 — 기존 폼 입력과 같은 보더·라운드.
      글자는 16px 이상이다(그 아래면 iOS 가 입력 순간 화면을 확대한다).
   -------------------------------------------------------------------------- */
.bn-match-input {
  width: 9rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background-color: var(--card);
  padding: 0.75rem 1rem;
  font: inherit;
  font-size: 1rem;
  color: var(--foreground);
}

.bn-match-input:focus-visible {
  outline: none;
  border-color: var(--gold-deep);
  box-shadow: 0 0 0 1px var(--gold-deep);
}

.bn-match-custom {
  margin-top: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background-color: var(--card);
}

.bn-match-custom-label {
  line-height: 1.6;
}

.bn-match-custom-row {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.bn-match-custom .bn-match-input {
  width: 8.5rem;
  min-height: 52px;
}

.bn-match-custom-unit {
  font-size: 1rem;
}

.bn-match-custom-hint {
  margin-top: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gold-deep);
}

/* --------------------------------------------------------------------------
   5. 조건 요약 칩 — 결과 화면에서 match.js 가 만든다. 한 줄 가로 스크롤이라
      조건이 늘어도 화면을 아래로 밀지 않는다.
   -------------------------------------------------------------------------- */
.bn-match-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  border: 1px solid color-mix(in oklab, var(--foreground) 22%, transparent);
  border-radius: 9999px;
  background-color: transparent;
  padding: 0.5rem 0.9rem;
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--foreground);
  transition:
    border-color 0.15s cubic-bezier(0.4, 0, 0.2, 1),
    color 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.bn-match-chip:hover {
  border-color: var(--gold-deep);
  color: var(--gold-deep);
}

.bn-match-chip:focus-visible {
  outline: none;
  box-shadow: 0 0 0 1px var(--gold-deep);
}

.bn-match-chip-key {
  color: var(--muted-foreground);
}

.bn-match-chips-hint {
  margin-top: 10px;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

/* --------------------------------------------------------------------------
   6. 단계 전환(C2) — 나가는 것은 140ms 안에 빠지고, 들어오는 것은 그만큼 기다렸다 들어온다.
      앞·뒤 방향이 같고, 가로로 움직이지 않으며, 높이는 곧장 바뀐다.

      · 나가는 것은 같은 프레임에 흐름에서 빠진다(`position: absolute`). 그래야 새 화면의
        자리가 즉시 정해지고, 나가는 것은 그 위에서 사라진다.
      · 들어오는 것은 그 프레임에 이미 DOM 에 있다(투명). 뒤늦게 그리면 포커스가 탭 밖에서
        일어나 iOS 가 키보드를 띄우지 않는다(9994 함정 2).
      · 질문·부제(order 0) 140ms → 선택지 묶음(order 1) 200ms → 보조(order 2) 260ms.
        선택지 묶음에는 blur 를 걸지 않는다 — 입력 묶음의 filter 는 WebView 가 버벅인다.

      패널 자신에는 **눈에 안 보이는 340ms 시계**만 건다. `entry-gate.js` 는 요소 자신의
      애니메이션만 기다리므로 잠금이 풀리는 때가 이 시계다 — 자식 끝(600ms)까지 잠그면
      답답하다. 패널에 transform 을 걸지 않는 것은 그 덕이기도 하다.

      `backwards` 지 `both` 가 아니다 — 끝값이 기본 스타일과 같아 `forwards` 는 아무것도
      더하지 않으면서 요소에 transform 을 붙들어 둔다.
   -------------------------------------------------------------------------- */
.bn-match-stage {
  position: relative;
}

/* flow-root — 질문의 윗마진이 이 상자 밖으로 새지 않게 한다. 새면 나가는 패널이 `absolute`
   로 바뀌는 순간 마진 길이만큼 아래로 튄다. */
.bn-match-panels {
  position: relative;
  display: flow-root;
}

@keyframes bn-match-clock {
  from {
    opacity: 1;
  }
  to {
    opacity: 1;
  }
}

@keyframes bn-match-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes bn-match-text-in {
  from {
    opacity: 0;
    transform: translateY(6px);
    filter: blur(2px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: blur(0);
  }
}

@keyframes bn-match-rise-16 {
  from {
    transform: translateY(16px);
  }
  to {
    transform: none;
  }
}

@keyframes bn-match-out {
  to {
    opacity: 0;
    transform: translateY(-6px);
  }
}

@keyframes bn-match-out-fade {
  to {
    opacity: 0;
  }
}

@keyframes bn-match-out-blur {
  to {
    filter: blur(2px);
  }
}

/* 시계 — 입력 잠금의 길이. 눈에 보이지 않고, 끝나면 아무것도 남기지 않는다. */
.bn-match-panel[data-enter="true"],
#bn-match-result[data-enter="true"],
.bn-match-batch[data-enter="true"] {
  animation: bn-match-clock 340ms linear;
}

/* order 0 — 질문·부제 */
.bn-match-panel[data-enter="true"] .bn-match-q,
.bn-match-panel[data-enter="true"] .bn-match-q-sub,
#bn-match-result[data-enter="true"] .bn-match-q {
  animation: bn-match-text-in 300ms var(--bn-expo) 140ms backwards;
}

/* order 1 — 선택지 묶음(스태거 없음), 결과의 칩 */
.bn-match-panel[data-enter="true"] .bn-match-choices,
#bn-match-result[data-enter="true"] #bn-match-chips {
  animation:
    bn-match-rise-16 400ms var(--bn-expo) 200ms backwards,
    bn-match-fade 300ms var(--bn-expo) 200ms backwards;
}

/* order 2 — 보조. 열린 채 되돌아온 직접 입력 칸(`data-enter-aux`)과 칩 아래 안내. */
.bn-match-custom[data-enter-aux="true"],
#bn-match-result[data-enter="true"] #bn-match-chips-hint {
  animation:
    bn-match-rise-16 400ms var(--bn-expo) 260ms backwards,
    bn-match-fade 300ms var(--bn-expo) 260ms backwards;
}

/* 나가는 패널·결과 상자 */
.bn-match-panel[data-leave="true"],
#bn-match-result[data-leave="true"] {
  position: absolute;
  inset-inline: 0;
  top: 0;
  pointer-events: none;
  animation: bn-match-out 140ms var(--bn-snap) forwards;
}

.bn-match-panel[data-leave="true"] .bn-match-q,
#bn-match-result[data-leave="true"] .bn-match-q {
  animation: bn-match-out-blur 140ms var(--bn-snap) forwards;
}

/* 결과로 넘어갈 때는 위쪽 줄까지 빠진다. 위저드 자신에는 transform 을 걸지 않는다 —
   안에 든 하단 바의 고정 위치 기준이 바뀌고, 안의 패널이 이미 제 움직임을 한다. */
#bn-match-wizard[data-leave="true"] {
  position: absolute;
  inset-inline: 0;
  top: 0;
  pointer-events: none;
  animation: bn-match-out-fade 140ms var(--bn-snap) forwards;
}

/* 결과 아래 행동 줄·하단 바는 **움직임 없는 페이드**다. 안에 화면 아래 고정 바가 있고,
   `transform` 은 그 고정 위치의 기준 상자를 화면에서 이 줄로 바꿔 버린다(패널에서 이미
   실측한 결함과 같은 원인). `opacity` 는 포함 블록을 만들지 않으므로 안전하다.
   길이는 시계와 같다 — 진입 규칙의 「끝날 때까지」가 화면마다 달라지지 않게. */
#bn-match-tail[data-enter="true"],
#bn-match-bar[data-enter="true"] {
  animation: bn-match-fade 340ms var(--bn-expo) backwards;
}

/* --------------------------------------------------------------------------
   7. CTA 모바일 치수 — 높이 56·라벨 14px. 사이트 CTA 문자열(`buttons.ts`)은 그대로
      쓰고 치수만 덧댄다. `custom.css` 의 `a.press.ko[class*="text-[0.66rem]"]`(12px)
      보다 특이도를 한 칸 높여, 스타일시트 순서와 무관하게 이긴다.
   -------------------------------------------------------------------------- */
a.press.bn-cta[class][class],
button.press.bn-cta[class][class] {
  min-height: 56px;
  padding-block: 0;
  padding-inline: 1rem;
  font-size: 0.875rem;
  letter-spacing: 0.14em;
}

/* --------------------------------------------------------------------------
   8. 하단 고정 바(모바일) — 직접 입력을 고른 단계에서는 「다음」, 결과에서는 전화·문의.
      다른 단계에는 바가 없다(`hidden`). 데스크톱에서는 본문 흐름으로 돌아간다.
   -------------------------------------------------------------------------- */
.bn-match-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bn-match-bar-next {
  flex: 1 1 auto;
}

a.press.bn-match-bar-tel[class] {
  flex: 0 0 auto;
  gap: 6px;
  padding-inline: 14px;
}

@media (max-width: 1023px) {
  .bn-match-actions {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 45;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border);
    background: color-mix(in oklab, var(--background) 94%, transparent);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    backdrop-filter: blur(14px) saturate(140%);
  }

  /* 바 높이(12+56+12) + 홈 인디케이터 + 숨 쉴 자리만큼 본문 끝을 비운다 —
     마지막 선택지·마지막 카드가 바 밑에 깔리지 않게. */
  #bn-match {
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px) + 24px);
  }

  /**
   * W1(UX-08) — **스크롤이 바를 피한다.**
   *
   * 바는 화면에 고정인데 스크롤 계산은 그걸 모른다. 그래서 브라우저가 「보이게」 스크롤한
   * 자리가 바 뒤였다(실측 390×844: 「직접 입력」 칸 809~861, 바 top 763 — 포커스는 들어가고
   * 화면엔 라벨 윗부분만). 칸마다 좌표를 계산해 덧대는 대신 **한 규칙**으로 문서 전체의
   * 스크롤 기준선을 바 위로 올린다 — 바 뒤로 갈 수 있는 모든 요소에 한꺼번에 걸린다.
   *
   * 값은 바 자신의 치수와 같은 식이다(12+56+12 + 홈 인디케이터) + 숨 쉴 16px.
   * 바가 고정인 폭에서만 둔다 — 데스크톱에서는 가리는 것이 없다.
   */
  html:has(#bn-match) {
    scroll-padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px) + 16px);
  }

  /* 「전화 상담」 FAB 내리기는 **이 파일에서 나갔다**(Z4). 위저드 페이지에만 있는 앵커로
     가리던 것이 화면별 목록의 한 칸이었고, 목록은 새 화면(404)을 자동으로 빠뜨렸다.
     지금은 결과 행동 줄의 「전화 상담」이 `data-bn-has-tel-cta` 를 달고, `custom.css` 의
     규칙 하나가 <1024 에서 FAB 를 내린다 — 전환점(1023)도 걸리는 시점도 전과 같다. */
}

@media (min-width: 1024px) {
  .bn-match-actions {
    flex-wrap: wrap;
    gap: 1rem;
  }

  #bn-match-bar {
    margin-top: 1.5rem;
  }

  /* 결과 아래 줄 — 1차 행동(상담 접수)이 먼저, 대안(전체 매물)이 그 옆이다. */
  .bn-match-tail {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
  }

  .bn-match-tail .bn-match-actions {
    order: -1;
  }

  .bn-match-bar-next {
    flex: 0 0 auto;
  }

  /* 데스크톱에는 상시 「전화 상담」 FAB 가 있다 — 같은 행동을 두 번 놓지 않는다. */
  .bn-match-bar-tel {
    display: none;
  }

}

/* --------------------------------------------------------------------------
   9. 홈 진입(H 안 A) — index 「어떤 유형의 빌딩이 맞으실까요」 부제 바로 뒤.
      모바일은 전체 폭 세로 스택, 데스크톱은 기존 CTA 블록처럼 가로 배치.
   -------------------------------------------------------------------------- */
.bn-entry {
  margin-top: 2rem;
}

.bn-entry-lead {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--foreground);
}

.bn-entry-stack {
  margin-top: 14px;
  display: grid;
  gap: 12px;
}

.bn-entry-stack > .bn-entry-item > .press {
  width: 100%;
}

.bn-entry-micro {
  margin-top: 8px;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}

@media (min-width: 768px) {
  .bn-entry-stack {
    grid-auto-flow: column;
    justify-content: start;
    gap: 1rem;
  }

  .bn-entry-stack > .bn-entry-item > .press {
    width: auto;
  }
}

/* --------------------------------------------------------------------------
   10. 위저드 히어로 · 위쪽 줄(C4)

       `<1024` — 첫 질문의 선택지가 첫 화면에 들어와야 한다. 사진이 없으니 어두운 면도 두지
       않는다(design.md 다크 섹션 금지). 헤더는 스크롤 뒤와 같은 밝은 상태로 고정되고
       (`data-bn-solid-header` → `app.js`), h1 한 줄은 그 아래 밝은 면의 흐름 안에 놓인다.
       붙는 것은 위쪽 줄뿐이다 — 문항이 길어 스크롤해도 진행과 남은 수는 보인다.
       `≥1024` — 히어로만 짧아지고 위쪽 줄은 흐름 안이다.
   -------------------------------------------------------------------------- */
.bn-match-topbar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
}

.bn-match-back {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  min-width: 44px;
  padding-inline-end: 8px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--foreground);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* 첫 단계 — 자리만 남긴다. `disabled` 이므로 포커스도 받지 않는다. */
.bn-match-back:disabled {
  visibility: hidden;
}

.bn-match-back:focus-visible {
  outline: 2px solid var(--gold-deep);
  outline-offset: 2px;
}

.bn-match-back-icon {
  flex: none;
  width: 18px;
  height: 18px;
}

.bn-match-progress-num {
  flex: none;
  font-size: 0.9375rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--foreground);
}

.bn-match-progress-track {
  flex: 1 1 auto;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background-color: var(--border);
}

/* 채움은 `width` 가 아니라 가로 축척으로 움직인다 — 4px 막대라도 폭을 애니메이션하면
   매 프레임 레이아웃을 다시 잰다. 트랙이 `overflow: hidden` 이라 모양은 같다. */
.bn-match-progress-fill {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background-color: var(--gold-deep);
  transform-origin: left center;
  transition: transform 520ms var(--bn-grow);
}

/* C5 — 지금 N건 남았어요. 숫자는 같은 칸에서 교체되고, 방향은 언제나 위다. */
.bn-match-remaining {
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--muted-foreground);
}

.bn-match-remaining strong {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--foreground);
}

.bn-match-roll {
  display: inline-grid;
  overflow: hidden;
  vertical-align: bottom;
}

.bn-match-roll > span {
  grid-area: 1 / 1;
}

.bn-match-roll > [data-roll="in"] {
  animation: bn-match-roll-in 320ms var(--bn-expo) backwards;
}

.bn-match-roll > [data-roll="out"] {
  animation: bn-match-roll-out 160ms var(--bn-snap) forwards;
}

@keyframes bn-match-roll-in {
  from {
    opacity: 0;
    transform: translateY(40%);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: blur(0);
  }
}

@keyframes bn-match-roll-out {
  to {
    opacity: 0;
    transform: translateY(-40%);
  }
}

/* 헤더는 이 화면에서 처음부터 밝은 상태다. 값은 번들의 `.glass` 와 `app.js` 의 밝은 상태와 같고,
   스크립트가 돌기 전·JS 없는 시작 화면도 같게 보이도록 여기 적는다.
   돌고 나면 `app.js` 가 `.glass` 와 테두리·그림자를 얹는다. */
html:has(#bn-match) {
  /* 74 = 패딩 14 + 로고 44 + 패딩 14 + 유리 헤더의 테두리 2 */
  --bn-match-header-h: 74px;
}

html:has(#bn-match) header {
  background-color: color-mix(in oklab, var(--bone) 62%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
}

html:has(#bn-match) header > div:first-child {
  padding-block: 14px;
}

html:has(#bn-match) header img {
  height: 44px;
}

html:has(#bn-match) header button[aria-expanded],
html:has(#bn-match) header nav a:not(:hover) {
  color: var(--foreground);
}

html:has(#bn-match) header a.press:not(:hover) {
  border-color: var(--gold-deep);
  background-color: var(--gold-deep);
  color: var(--bone);
}

/* 사진 위 가독성용 그라데이션(`custom.css` §7) — 이 화면에는 사진이 없다. */
html:has(#bn-match) header.bg-transparent::before {
  display: none;
}

.bn-match-hero {
  background-color: var(--background);
}

.bn-match-hero-inner {
  padding-top: calc(var(--bn-match-header-h) + 12px);
}

.bn-match-hero-title {
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--foreground);
}

.bn-match-hero-sub,
.bn-match-hero-cross {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}

.bn-match-hero-cross a {
  color: var(--foreground);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.bn-match-hero-cross a:hover {
  color: var(--gold-deep);
}

@media (max-width: 1023px) {
  /* 58 = 패딩 6 + 로고 44 + 패딩 6 + 유리 헤더의 테두리 2. 위쪽 줄이 그 아래 붙는다. */
  html:has(#bn-match) {
    --bn-match-header-h: 58px;
    scroll-padding-top: calc(var(--bn-match-header-h) + 72px);
  }

  html:has(#bn-match) header > div:first-child {
    padding-block: 6px;
  }

  .bn-match-hero-title {
    font-size: 15px;
  }

  .bn-match-hero-sub,
  .bn-match-hero-cross {
    display: none;
  }

  #bn-match {
    padding-top: 0;
  }

  .bn-match-topbar {
    position: sticky;
    top: var(--bn-match-header-h);
    z-index: 20;
    margin-inline: -24px;
    padding: 6px 24px 8px;
    background-color: var(--background);
  }

  /* 첫 질문의 선택지가 첫 화면에 들어와야 한다(M-5) — 진행 표시와 질문 사이에
     데스크톱용 여백(mt-14)을 두지 않는다. */
  .bn-match-panels[class] {
    margin-top: 0;
  }

  .bn-match-q[class] {
    margin-top: 14px;
    font-size: 1.75rem;
    line-height: 1.25;
  }

  .bn-match-q-sub[class] {
    margin-top: 8px;
    font-size: 1rem;
    line-height: 1.6;
  }
}

@media (min-width: 1024px) {
  /* 설문 칼럼. h1 줄·위쪽 줄·패널·바가 같은 폭·같은 왼쪽 끝이다. */
  .bn-match-hero-inner,
  #bn-match-wizard,
  [data-bn-match-start] {
    max-width: 40rem;
    margin-inline: auto;
  }

  .bn-match-hero-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 10px;
  }

  .bn-match-hero-title {
    font-size: 1rem;
  }

  .bn-match-hero-cross {
    margin-left: auto;
  }

  #bn-match {
    padding-top: 0.25rem;
  }

  .bn-match-panels[class] {
    margin-top: 1.25rem;
  }

  /* 40rem 칼럼에 맞춘 질문 크기. 번들 `.display-lg`(최대 4rem)를 이긴다. */
  .bn-match-q[class] {
    font-size: 2.5rem;
    line-height: 1.25;
  }

  /* 선택지 전부가 첫 화면에 든다(1440×900, 6개·7개짜리 단계). */
  .bn-match-q-sub[class] {
    margin-top: 0.5rem;
    line-height: 1.6;
  }

  .bn-match-choices[class] {
    margin-top: 1.25rem;
    gap: 0.75rem;
  }

  .bn-match-choice[class] {
    padding: 0.875rem 1.25rem;
  }
}

/**
 * W3 — **짧은 화면**(375×667 · 360×640)에서 한 단 더 줄인다.
 *
 * 왜 높이로 재는가: 첫 질문이 첫 화면에 드는지는 폭이 아니라 **세로 길이**가 정한다.
 * 그래서 폭으로 기기를 짐작해 값을 흩뿌리지 않고, 짧다는 사실 하나에 한 묶음을 건다.
 *
 * 경계 700px — 667·640 이 걸리고, 기준 기기 844·800 은 걸리지 않아 그 배치는 그대로다.
 * 줄이는 자리는 전부 **여백과 글자 단**이다(레이아웃을 새로 짜지 않는다).
 */
@media (max-width: 1023px) and (max-height: 700px) {
  .bn-match-q[class] {
    margin-top: 10px;
    font-size: 1.5rem;
  }

  .bn-match-q-sub[class] {
    margin-top: 6px;
    font-size: 0.875rem;
  }

  .bn-match-choices[class] {
    margin-top: 12px;
  }
}

/**
 * Y14(B-9) · Z6 — **가로 모드**(높이 ≤500)에서 한 단 더. 위 규칙과 **같은 축**(세로 길이)의
 * 다음 칸이다.
 *
 * 첫 화면의 세로 예산은 「헤더 ~ 화면 끝」이다. 위쪽 줄의 남은 수 줄을 진행 줄 옆으로 올리지
 * 않고 내리지도 않는다 — 스크롤을 해도 붙어 있으므로 대신 질문 부제를 내린다.
 * 결과 화면의 하단 바는 세로 치수를 조인다 — 버튼 56 → 44(G7 하한 그대로), 패딩 12 → 8.
 * 바가 얇아진 만큼 `#bn-match` 의 끝 여백·`scroll-padding-bottom` 도 같은 식으로 줄인다
 * (값이 세 곳에 있으니 한쪽만 줄이면 마지막 선택지가 바 밑에 깔리거나 빈 띠가 생긴다).
 * 글자 단은 더 내리지 않는다(읽을 수 없게 만들면서까지 선택지를 넣지는 않는다).
 */
@media (max-width: 1023px) and (max-height: 500px) {
  .bn-match-q-sub[class] {
    display: none;
  }

  .bn-match-q[class] {
    margin-top: 6px;
    font-size: 1.25rem;
  }

  .bn-match-choices[class] {
    margin-top: 8px;
  }

  .bn-match-actions {
    padding-top: 8px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  }

  /* 치수 정본(7절 `a.press.bn-cta[class][class]`, 56px)보다 **한 칸 위**여야 이긴다 —
     특이도를 맞추지 않으면 이 줄은 조용히 무시된다(첫 시도에서 바가 8px 만 줄었다). */
  .bn-match-actions a.press.bn-cta[class][class],
  .bn-match-actions button.press.bn-cta[class][class] {
    min-height: 44px;
  }

  #bn-match {
    padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px) + 24px);
  }

  html:has(#bn-match) {
    scroll-padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px) + 16px);
  }
}

/* 본문 속 짧은 텍스트 링크의 터치 영역을 44px 로 */
.bn-match-tap {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

/* --------------------------------------------------------------------------
   11. 결과 — 한 줄 가로 스크롤 칩 · 1열 카드 · 전체 폭 더 보기
   -------------------------------------------------------------------------- */
#bn-match-headline {
  font-variant-numeric: tabular-nums;
}

/* 결과 아래 줄의 끝 — 「처음부터 다시」(C8). 위쪽 행동보다 작은 글자 링크다. */
.bn-match-restart[class] {
  margin-top: 12px;
}

@media (min-width: 1024px) {
  .bn-match-restart[class] {
    margin-top: 0;
  }
}

/**
 * C8 — 결과 안의 카드 등장. 번들의 `.reveal`(0.9s 전환)을 이 값이 이긴다. 끝난 뒤 카드에
 * transform 을 남기지 않는다. 지연은 `match.js` 가 카드마다 준다: `min(i,3)*50ms`.
 */
#bn-match-result .reveal {
  opacity: 1;
  transform: none;
  transition: none;
  animation: bn-match-card-in 420ms var(--bn-expo) var(--bn-card-delay, 0ms) backwards;
}

@keyframes bn-match-card-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/**
 * 「더 보기」로 붙는 카드 묶음(`match.js` 가 만든다).
 *
 * **상자를 만들지 않는다.** `display: contents` 라 안의 카드가 그리드의 직계 자식으로
 * 그대로 배치된다 — 묶음이 있을 때와 없을 때의 화면이 같다(실측: 3열에서 새 카드 셋이
 * 기존과 같은 트랙에 놓였다). 묶음이 필요한 이유는 배치가 아니라 **진입 규칙**이다:
 * 「지금 새로 나타난 것」이 정확히 무엇인지 DOM 에 있어야 `inert` 를 거기 하나에 건다
 * (`inert` 는 상자 없는 요소에서도 안쪽 전부의 hit test 를 막는다 — 실측으로 확인했다).
 *
 * 진입 애니메이션(§6 의 `data-enter`)은 상자가 없어 **눈에 보이지 않는다** — 화면이
 * 들어올 때와 같은 시계로 「진입이 끝날 때까지」의 길이를 한 자에 맞춘다.
 * 눈에 보이는 등장은 위 카드 애니메이션이 맡는다.
 */
.bn-match-batch {
  display: contents;
}

@media (max-width: 1023px) {
  #bn-match-chips {
    margin-top: 18px;
    margin-inline: -24px;
    padding-inline: 24px;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    /* 오른쪽 끝을 흐리게 — 「아직 더 있다」를 스크롤바 없이 알린다. */
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent);
  }

  #bn-match-chips::-webkit-scrollbar {
    display: none;
  }

  .bn-match-chip {
    flex: none;
    padding-inline: 14px;
    white-space: nowrap;
  }

  #bn-match-grid,
  #bn-match-near {
    margin-top: 24px;
    gap: 20px;
  }

  #bn-match-near-wrap {
    margin-top: 28px;
    padding-top: 28px;
  }

  #bn-match-more-wrap {
    margin-top: 20px;
  }

  #bn-match-more {
    width: 100%;
    height: auto;
    min-height: 52px;
    font-size: 0.875rem;
  }

  .bn-match-alt {
    margin-top: 28px;
  }
}

/* --------------------------------------------------------------------------
   12. 제목 포커스 링 — 전환 때문에 포커스를 잃으면 `match.js` 가 새 화면의 제목
       (`.bn-match-q`, `tabindex="-1"`)으로 옮긴다. 그때 보이는 링은 **사이트의 링**이어야
       한다. 그냥 두면 UA 기본값(`outline: auto`)이 파란 계단 모양으로 뜬다 — 이 사이트에
       없는 색이고, 제목 글자의 굴곡을 따라 그려져 모양도 다르다.

       값은 `custom.css` 의 사이트 포커스 링 선언(모달 닫힘 후 카드)에서 그대로 가져왔다:
       `outline: 2px solid var(--gold-deep, #C20A45); outline-offset: 3px`. 새 색·새 굵기를
       짓지 않는다. 포인터로 온 경로(`:focus-visible` 이 false)에서는 링이 보이지 않는다 —
       그쪽은 우리가 옮긴 포커스가 아니라 브라우저가 준 클릭 포커스다.
   -------------------------------------------------------------------------- */
.bn-match-q[tabindex="-1"]:focus-visible {
  outline: 2px solid var(--gold-deep, #C20A45);
  outline-offset: 3px;
}

.bn-match-q[tabindex="-1"]:focus:not(:focus-visible) {
  outline: none;
}

/* --------------------------------------------------------------------------
   동작 줄이기(C9) — **애니메이션을 없애지 않는다.** 움직임만 뺀 같은 길이의 페이드로 바꾼다.
   없애 버리면 끝 신호가 영영 오지 않아 진입 게이트가 기다릴 신호를 잃고, 그 자리를 미디어쿼리로
   한 번 더 추측하게 된다.

   번들(`styles-BA9J2VGO.css`, 수정 금지)이 여기서
   `*,:before,:after { animation-duration: .01ms !important; transition-duration: .01ms !important }`
   로 **모든** 길이를 0 으로 누른다. 그러면 시계가 0.01ms 만에 끝나 게이트가 패널이 보이기도
   전에 열린다(실측: 250ms 진입 → 260ms inert, 280ms 이미 해제 → 300ms 재탭이 2단계를 답했다).
   `!important` 로 되돌리되 **움직임은 없다.** 선택자 특이도가 `*` 보다 높아 이 선언이 이긴다.

   눌림·체크 팝·blur·숫자 롤의 이동은 끈다. 건수 글자는 `match.js` 가 바로 바꾼다.
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .bn-match-panel[data-enter="true"],
  #bn-match-result[data-enter="true"],
  .bn-match-batch[data-enter="true"] {
    animation-duration: 340ms !important;
  }

  .bn-match-panel[data-enter="true"] .bn-match-q,
  .bn-match-panel[data-enter="true"] .bn-match-q-sub,
  #bn-match-result[data-enter="true"] .bn-match-q {
    animation-name: bn-match-fade;
    animation-duration: 300ms !important;
  }

  .bn-match-panel[data-enter="true"] .bn-match-choices,
  #bn-match-result[data-enter="true"] #bn-match-chips,
  .bn-match-custom[data-enter-aux="true"],
  #bn-match-result[data-enter="true"] #bn-match-chips-hint {
    animation-name: bn-match-fade;
    animation-duration: 300ms !important;
  }

  .bn-match-panel[data-leave="true"],
  #bn-match-result[data-leave="true"],
  #bn-match-wizard[data-leave="true"] {
    animation-name: bn-match-out-fade;
    animation-duration: 140ms !important;
  }

  .bn-match-panel[data-leave="true"] .bn-match-q,
  #bn-match-result[data-leave="true"] .bn-match-q {
    animation: none;
  }

  #bn-match-tail[data-enter="true"],
  #bn-match-bar[data-enter="true"] {
    animation-duration: 340ms !important;
  }

  #bn-match-result .reveal {
    animation-name: bn-match-fade;
    animation-duration: 420ms !important;
  }

  .bn-match-choice[class]:active {
    transform: none;
  }

  .bn-match-choice[aria-pressed="true"] .bn-match-check,
  .bn-match-choice[data-chosen="true"] .bn-match-check {
    animation: none;
  }

  .bn-match-panel[data-advancing="true"] .bn-match-choice[aria-pressed="false"],
  .bn-match-panel[data-advancing="true"] .bn-match-choice:not([aria-pressed]):not([data-chosen]) {
    filter: none;
  }

  .bn-match-progress-fill {
    transition: none;
  }
}
