/* =========================================================
   item-card.css — 상품 카드 v2 (.pcard) + 리스트 상태 UI
   list.php · search.php 전용. 구 카드(item-list.css)는 찜목록·기획전이
   이관을 마칠 때까지 병존한다.

   사용법:
     리스트·검색  <div id="ttList" class="pcard-list">…</div>   (모바일 1열 · 웹 4열)

   카드 슬롯 (위→아래):
     장르·지역 | 📍장소  →  제목  →  가격+뱃지+쿠폰(한 줄, 넘치면 랩)
     → (모바일: 남는 높이 흡수) → 별점 → AI 후기 (썸네일 하단 밀착)
   타이포 표준 — 크기 3단 · 색 3종(ink/muted/primary) · 굵기 3단(400/600/700):
     모바일 12/16/16px(1열 행 카드) · 웹 13/17/17px(그리드 카드 공통 표준 — 2026-07-10 통일)
   토큰: css/tokens.css(:root) — 이 파일보다 먼저 로드한다 (2026-07-08 SSoT 추출).
   ========================================================= */

/* 레거시 전역은 box-sizing 미설정(content-box) — 카드 스코프만 border-box */
.pcard-list,
.pcard-list * {
  box-sizing: border-box;
}

.pcard-list {
  font-family: var(--tt-font);
  color: var(--tt-ink);
  padding: 0 1rem;
}


/* =========================
   카드 — 가로 row (모바일 1열 · 검색). 썸네일 5:7 고정.
   ========================= */
.pcard {
  position: relative;
  display: flex;
  align-items: flex-start; /* 썸네일 비율 고정 (stretch 금지) */
  min-width: 0;
  gap: 0.9375rem;
  padding: 1.125rem 0;
  border-bottom: 1px solid var(--tt-border);
  background: var(--tt-surface);
  text-align: left;
}

.pcard:last-child {
  border-bottom: none;
}

/* 카드 전체 클릭 — 오버레이 링크 (하트 버튼과 중첩 없는 유효 마크업) */
.pcard__link {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: 0.75rem;
}

/* 터치 피드백 — 컨테이너 패딩 폭까지 */
.pcard::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -1rem;
  right: -1rem;
  background: transparent;
  pointer-events: none;
  transition: background-color 0.12s var(--tt-ease);
}

.pcard:active::before {
  background: var(--tt-press);
}

.pcard__thumb {
  position: relative;
  z-index: 2; /* 오버레이 링크(z1) 위 — 어떤 스태킹에서도 하트 클릭 보장 */
  pointer-events: none; /* 포스터 클릭은 아래 링크로 통과, 하트만 auto 로 복원 */
  flex-shrink: 0;
  width: 6.5rem;
  aspect-ratio: 5 / 7;
  border-radius: 0.75rem;
  background: var(--tt-sunken);
  overflow: hidden;
}

/* 밝은 포스터 경계 보호 링 */
.pcard__thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 0.75rem;
  box-shadow: inset 0 0 0 1px rgba(9, 9, 11, 0.06);
  pointer-events: none;
}

.pcard__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}


/* =========================
   정보영역 — 상단 3줄+쿠폰 슬롯 고정, 별점·AI는 썸네일 하단 밀착
   ========================= */
.pcard__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3125rem;
  padding: 0.0625rem 0; /* 포스터 상·하단보다 1px 안쪽 */
  min-height: 9.1rem; /* 포스터 높이와 동일 (border-box) → 상·하단 정렬 일치 */
}

/* ① 메타 줄 — 좌: 장르·지역 / 우: 핀+장소 */
.pcard__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.625rem;
  min-width: 0;
}

.pcard__cate {
  flex: 0 1 auto;
  min-width: 0;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--tt-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pcard__status {
  display: inline-block;
  font-style: normal;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1;
  padding: 0.1875rem 0.3125rem;
  border-radius: 0.3125rem;
  margin-right: 0.375rem;
  color: var(--tt-muted);
  background: var(--tt-sunken);
  vertical-align: 0.0625rem;
}

.pcard__place {
  flex: 0 1 auto;
  display: flex;
  align-items: center;
  gap: 0.0625rem;
  max-width: 55%;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--tt-muted);
  min-width: 0;
}

.pcard__place svg {
  width: 0.8125rem;
  height: 0.8125rem;
  flex-shrink: 0;
  stroke: var(--tt-hint);
  stroke-width: 1.6;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pcard__place span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ② 제목 — 모바일 1줄 말줄임 (웹은 줄바꿈) */
.pcard__title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--tt-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ③ 가격 줄 — 할인율·판매가 + 프로모 뱃지(타임세일·NEW) */
.pcard__price {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.375rem;
  font-variant-numeric: tabular-nums;
}

.pcard__dc {
  font-size: 1rem;
  font-weight: 700;
  color: var(--tt-primary);
}

.pcard__dc:empty {
  display: none;
}

.pcard__pr {
  font-size: 1rem;
  font-weight: 700;
  color: var(--tt-ink);
  margin-right: 0.125rem;
}

.pcard__price .promo_timesale,
.pcard__price .promo_new {
  display: inline-flex;
  align-items: center;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1;
  padding: 0.25rem 0.40625rem;
  border-radius: 0.4375rem;
  border: 0;
  letter-spacing: 0;
}

.pcard__price .promo_timesale { background: var(--tt-timesale-soft, #fae8e6); color: var(--tt-timesale, #e11d48); }
.pcard__price .promo_new      { background: var(--tt-new-soft);      color: var(--tt-new); }

/* 쿠폰 썸네일 오버레이 — 웹 그리드 전용 (기본 숨김) */
.pcard__thumb-coupon {
  display: none;
}

/* ④ 쿠폰 — 가격 아래 낮은 칩 (있을 때만, 가격과는 살짝 더 띄움) */
.pcard__coupon {
  display: flex;
  margin-top: 0.125rem;
}

.pcard__coupon .dcoupon_label {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.1875rem 0.5rem;
  background: var(--tt-surface);
  border: 1px solid var(--tt-border-strong);
  border-radius: 0.4375rem;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--tt-ink-2);
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
}

.pcard__coupon .dcoupon_label__icon {
  width: 0.8125rem;
  height: 0.8125rem;
  flex-shrink: 0;
  fill: var(--tt-new);
}

/* ⑤ 별점 — 하단 그룹 시작 (남는 높이는 이 위에서 흡수) */
.pcard__review {
  display: flex;
  align-items: center;
  gap: 0.3125rem;
  margin-top: auto;
  font-size: 0.75rem;
  color: var(--tt-muted);
}

.pcard__review b {
  font-size: 0.75rem; /* N건의 후기(.pcard__review-cnt)와 동일 — 색·굵기는 유지 */
  font-weight: 600;
  color: var(--tt-ink);
}

.pcard__review-cnt {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.pcard__review-cnt::before {
  content: "·";
  margin-right: 0.3125rem;
  color: var(--tt-border-strong);
}

.pcard__star {
  width: 0.75rem; /* 별점 점수·후기 글자와 동일 리듬 — 색(fill)은 유지 */
  height: 0.75rem;
  flex-shrink: 0;
  fill: var(--tt-star);
}

/* ⑥ AI 후기 인용 — 카드 폭 안에서만, 넘치면 말줄임 */
.pcard__ai {
  display: flex;
  align-items: center;
  gap: 0.3125rem;
  font-size: 0.75rem;
  line-height: 1.3;
  color: var(--tt-muted);
  min-width: 0;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

/* 별점이 없고 AI만 있으면 AI가 하단 고정 (별점 뒤에 오면 해제) */
.pcard__body > .pcard__ai {
  margin-top: auto;
}

.pcard__review + .pcard__ai {
  margin-top: 0;
}

.pcard__ai i {
  flex-shrink: 0;
  align-self: center;      /* 부모가 stretch 여도 세로로 안 늘어남 */
  font-style: normal;
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
  padding: 0.1875rem 0.3125rem;
  border-radius: 0.3125rem;
  white-space: nowrap;     /* 'AI' 줄바꿈 금지 */
  color: var(--tt-new);
  background: var(--tt-new-soft);
}

.pcard__ai q {
  quotes: "\201C" "\201D";
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* =========================
   찜 하트 — 마이티켓 찜 목록의 토글 버튼과 동일 (반투명 원형)
   ========================= */
/* 하트 — 에어비앤비식 반투명 오버레이(웹·모바일 공통, myticket .wish-card__toggle 과 동일 문법):
   다크 반투명 필 + 흰 스트로크. 흰 코인 배경은 포스터를 가려 기각 (2026-07-08) */
.pcard__wish {
  position: absolute;
  top: 0.2rem;
  right: 0.2rem;
  z-index: 3;
  pointer-events: auto;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.pcard__wish svg {
  width: 1.375rem;
  height: 1.375rem;
  fill: rgba(9, 9, 11, 0.45);
  stroke: #fff;
  stroke-width: 1.8;
  stroke-linejoin: round;
  transition: fill 0.12s var(--tt-ease), transform 0.12s var(--tt-ease);
}

.pcard__wish.is-on svg {
  fill: var(--tt-primary);
  animation: pcard-wish-pop 0.2s var(--tt-ease);
}

.is-web .pcard__wish:hover svg { transform: scale(1.1); }

@keyframes pcard-wish-pop {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.18); }
  100% { transform: scale(1); }
}


/* =========================
   판매종료 (검색)
   ========================= */
.pcard.is-closed .pcard__img {
  filter: saturate(0);
  opacity: 0.55;
}

.pcard.is-closed .pcard__wish {
  display: none;
}


/* =========================================================
   웹 (.is-web) — 4열 포스터 그리드, 유동 높이·일정 gap
   ========================================================= */
.is-web .pcard-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2.25rem 1.25rem; /* 웹 4열 그리드 공통 gap — 메인 tsall·content-list 와 통일 (2026-07-10) */
  padding: 2rem 0 4rem;
  align-items: start;
}

.is-web .pcard-list .pcard {
  flex-direction: column;
  align-items: stretch; /* 세로 배치 — 본문 폭을 카드 폭에 고정해야 말줄임이 동작 */
  gap: 0;
  padding: 0;
  border-bottom: none;
  /* 카드 배경이 페이지와 같은 흰색(투명)이라 카드 자체 라운드는 안 보이는데,
     overflow:hidden 과 만나면 하단 좌측 모서리에 걸친 AI 뱃지가 잘려 일그러져 보였다.
     → 라운드 제거(사각), overflow:hidden 은 이웃 침범 방지용으로 유지. 썸네일은 자체 라운드. */
  overflow: hidden;
}

/* hover — 카드는 제자리, 포스터만 은은히 줌인 (커머스 표준 마이크로 인터랙션) */
.is-web .pcard-list .pcard__img {
  transition: transform 0.35s var(--tt-ease);
}

.is-web .pcard-list .pcard:hover .pcard__img {
  transform: scale(1.05);
}

.is-web .pcard-list .pcard::before {
  display: none;
}

.is-web .pcard-list .pcard__thumb {
  width: 100%;
  aspect-ratio: 5 / 7;
  border-radius: 0.75rem; /* DESIGN.md rounded.md(12px) — 카드 썸네일 표준 (구 0.875 반단계 정리) */
}

.is-web .pcard-list .pcard__thumb::after {
  border-radius: 0.75rem;
}

.is-web .pcard-list .pcard__body {
  margin-top: 0.75rem; /* 썸네일→텍스트 웹 표준 — 메인·그리드 카드와 통일 */
  gap: 0.4375rem; /* 웹 카드 공통 info gap */
  padding: 0;
  min-height: 0; /* 그리드는 유동 높이 */
}

/* 웹 타이포 표준: 13 / 16 / 17px — 줄간격도 통일해 슬롯 간 gap 이 일정하게 보이도록 */
.is-web .pcard__cate,
.is-web .pcard__place,
.is-web .pcard__price,
.is-web .pcard__review,
.is-web .pcard__ai { line-height: 1.25; }
.is-web .pcard__cate   { font-size: 0.8125rem; }
.is-web .pcard__place  { font-size: 0.8125rem; }
.is-web .pcard__place svg { width: 0.9375rem; height: 0.9375rem; }
.is-web .pcard__title  {
  font-size: 1.0625rem; /* 웹 그리드 카드 제목 17px 표준 — tsall·content-list 와 통일 (2026-07-10) */
  white-space: normal; /* 웹은 말줄임 없이 줄바꿈 */
  overflow: visible;
  text-overflow: clip;
}
.is-web .pcard__dc     { font-size: 1.0625rem; }
.is-web .pcard__pr     { font-size: 1.0625rem; }
.is-web .pcard__price .promo_timesale,
.is-web .pcard__price .promo_new { font-size: 0.75rem; padding: 0.3125rem 0.5rem; border-radius: 0.5rem; }
/* 웹 그리드: 쿠폰은 썸네일 우측 하단 오버레이 — 어떤 포스터색 위에서도 또렷하게
   (솔리드 화이트 + 부양 그림자, 가격 아래 쿠폰 줄은 숨김) */
.is-web .pcard-list .pcard__coupon {
  display: none;
}

.is-web .pcard-list .pcard__thumb-coupon {
  display: flex;
  position: absolute;
  right: 0.75rem; /* 0.5rem 은 큰 필+그림자가 가장자리에 밀착돼 보여 한 단계 안쪽으로 (2026-07-08) */
  bottom: 0.75rem;
  z-index: 1;
  max-width: calc(100% - 1.5rem);
}

.is-web .pcard-list .pcard__thumb-coupon .dcoupon_label {
  display: inline-flex;
  align-items: center;
  gap: 0.3125rem;
  padding: 0.3125rem 0.625rem;
  background: var(--tt-surface);
  border: 0;
  border-radius: 0.5625rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--tt-ink);
  white-space: nowrap;
  overflow: hidden;
  /* 부양 그림자 절반 강도 — 0.18/0.16 은 스티커처럼 떠 보임(에어비앤비류 오버레이 배지 관례 수준으로, 2026-07-08) */
  box-shadow: 0 0 0 1px rgba(9, 9, 11, 0.05), 0 2px 6px rgba(9, 9, 11, 0.09), 0 6px 16px rgba(9, 9, 11, 0.08);
}

.is-web .pcard-list .pcard__thumb-coupon .dcoupon_label__icon {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  fill: var(--tt-new);
}

.is-web .pcard__review { font-size: 0.8125rem; margin-top: 0; }
.is-web .pcard__review b { font-size: 0.8125rem; } /* N건의 후기와 동일 — 색·굵기 유지 */
.is-web .pcard__star   { width: 0.8125rem; height: 0.8125rem; } /* 점수·후기 글자와 동일 리듬 */
.is-web .pcard__ai     { font-size: 0.8125rem; margin-top: 0 !important; }


/* =========================================================
   상태 UI — 스켈레톤 · 스피너 · 빈 결과 · 검색 헤더 · 토스트
   ========================================================= */

/* 스켈레톤: 실카드와 동일 슬롯 비율. JS가 .pcard.pcard--skel로 생성 */
.pcard--skel {
  pointer-events: none;
}

.pcard--skel .sk {
  display: block;
  border-radius: 0.375rem;
  background: linear-gradient(90deg, var(--tt-sunken) 25%, var(--tt-sunken-2) 45%, var(--tt-sunken) 65%);
  background-size: 200% 100%;
  animation: pcard-shimmer 1.4s linear infinite;
}

.pcard--skel .sk--thumb {
  border-radius: 0.75rem;
  width: 100%;
  height: 100%;
}

.pcard--skel .sk--w60 { width: 60%; height: 0.75rem; }
.pcard--skel .sk--w90 { width: 90%; height: 1rem; margin-top: 0.5rem; }
.pcard--skel .sk--w40 { width: 40%; height: 0.875rem; margin-top: 0.625rem; }

@keyframes pcard-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* 무한스크롤 센티널 — 로딩 순간에만 스피너, 그 외엔 침묵 */
.pcard-loader {
  display: flex;
  justify-content: center;
  padding: 0.625rem 0 1rem;
  min-height: 0.5rem;
}

.pcard-spinner {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  border: 0.15625rem solid var(--tt-border);
  border-top-color: var(--tt-primary);
  animation: pcard-spin 0.8s linear infinite;
}

@keyframes pcard-spin {
  to { transform: rotate(360deg); }
}

/* 빈 결과 — 타이포 중심 */
.pcard-empty {
  grid-column: 1 / -1;
  padding: 6rem 1rem;
  text-align: center;
}

.pcard-empty__title {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--tt-ink);
}

.pcard-empty__sub {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--tt-muted);
}

.pcard-empty__reset {
  margin-top: 1.5rem;
  height: 2.25rem;
  padding: 0 1.25rem;
  border: 0;
  border-radius: 0.75rem;
  background: var(--tt-sunken);
  color: var(--tt-ink);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.12s var(--tt-ease);
}

.pcard-empty__reset:hover {
  background: var(--tt-sunken-2);
}

/* 검색 결과 헤더 */
.tt-searchhead {
  padding: 1rem 1rem 0;
  font-size: 0.9375rem;
  color: var(--tt-ink-2);
  font-family: var(--tt-font);
}

.tt-searchhead b {
  font-weight: 700;
  color: var(--tt-primary-ink);
}

.tt-searchhead span {
  font-weight: 600;
  color: var(--tt-ink);
  font-variant-numeric: tabular-nums;
}

.is-web .tt-searchhead {
  margin: 2rem auto 1.25rem;
  padding: 0;
}

/* 토스트 — 찜 완료 등 짧은 피드백 */
.tt-toast {
  position: fixed;
  left: 50%;
  bottom: 5.5rem; /* 모바일: 바텀 GNB 위 */
  transform: translateX(-50%) translateY(0.5rem);
  background: rgba(30, 25, 25, 0.92);
  color: var(--tt-surface);
  font-family: var(--tt-font);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.625rem 1.125rem;
  border-radius: 9999px;
  white-space: nowrap;
  z-index: 10020;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s var(--tt-ease), transform 0.18s var(--tt-ease);
}

.tt-toast.is-on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.is-web .tt-toast {
  bottom: 2.5rem;
}


/* =========================
   모션 감소 대응
   ========================= */
@media (prefers-reduced-motion: reduce) {
  .pcard,
  .pcard__wish svg,
  .pcard--skel .sk,
  .pcard-spinner {
    animation: none !important;
    transition: none !important;
  }

  .is-web .pcard-list .pcard__img,
  .is-web .pcard-list .pcard:hover .pcard__img {
    transition: none;
    transform: none;
  }
}
