/* ============================================================
 * App Shell
 * ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

.app-shell {
  max-width: var(--layout-mobile-width);
  margin: 0 auto;
  min-height: 100dvh;
  /* 기본 레이어 = Pearl(--color-bg, TASK-065 D3 유저 확정) — 구 muted(gray-100)는 pearl 표면과 색온도 충돌 (TASK-086 M6) */
  background: var(--color-bg);
  font-family: var(--font-sans);
  color: var(--color-fg);
}

/* Status Bar */
.status-bar {
  height: var(--size-statusbar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px 0 30px;
  background: var(--color-bg);
  flex-shrink: 0;
}
.status-bar__time {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--color-fg);
}
.status-bar__icons { display: flex; gap: 6px; align-items: center; color: var(--color-fg); }

/* Page Header — 대형 배너 헤더 표준 (TASK-092, T92-D01 — 유저 대면 전 페이지 상단 통일).
   계약: 고정 높이 --size-header-lg(76px, 페이지 간 1px도 안 갈리게) + 내용 수직 중앙 +
   pearl 배경(--color-bg) + 하단 보더(--color-border) + sticky top:0 (구 상품탭 룩앤필).
   z-index 20 = 스크롤 콘텐츠(카드 하트 z-index:1) 위, 하단 네비(30)·FAB(40)·팝오버(50) 아래 (TASK-058 #8).
   변형 2종: ① 로고 셸(.top-bar 내장 — shared/_shell_header, 홈·랜딩)
             ② 대형 타이틀(.page-header--title — shared/_page_header, 탭·하위 전 페이지). */
.page-header {
  height: var(--size-header-lg);
  background: var(--color-bg);
  border-bottom: var(--border-width) solid var(--color-border);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 20;
}
.top-bar {
  height: 100%; /* 부모 .page-header 고정 높이(76px)에 정합 — 로고 수직 중앙 (TASK-092) */
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-page);
}
/* 대형 타이틀 변형 (shared/_page_header) — 타이틀 = 2xl(24px)/700 좌측 정렬, 문구(eyebrow류) 금지.
   좌측 뒤로가기(선택)·우측 trailing(메타/액션, 선택)과 한 줄 배치 (T92-D01 assumption ③). */
.page-header--title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-page);
}
/* 뒤로가기 있는 페이지 = 히트박스(44px) 광학 보정 — back-header(TASK-044 ④)와 동일 왼쪽 4px */
.page-header--title:has(> .page-header__back) { padding-left: var(--space-1); }
.page-header__back {
  width: var(--size-touch-min);  /* 터치 타깃 44px (TASK-086 H3) */
  height: var(--size-touch-min);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-fg);
}
.page-header__title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-fg);
  line-height: var(--line-height-tight);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* 우측 메타(찜 개수 등) — 구 back-header__meta 승계 */
.page-header__meta {
  flex-shrink: 0;
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-medium);
  color: var(--color-fg-brand-strong);
}
/* 브랜드 로고 = 가로형 시그니처 이미지 (TASK-065 B1 — shared/_brand_logo).
   높이 26px(비율 4.23:1 → 폭 ~110px) — 대형 배너 바(--size-header-lg) 안에서 클리어스페이스(30%) 여유 확보 */
.top-bar__brand { display: inline-flex; align-items: center; }
.top-bar__brand-img { display: block; height: 26px; width: auto; }

/* 이미지 부재 폴백 (TASK-065 E1·E2 — shared/_image_placeholder) —
   썸네일/아바타 컨테이너를 채우는 Beige 면 + 무 심볼 워터마크 */
.img-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: var(--color-bg-brand);
  border-radius: inherit;
}
/* 화면별 썸네일 img 규칙(width:100%·object-fit:cover)보다 특정도 높게 —
   심볼은 컨테이너 비례 워터마크(40%, 상한 44px)로 고정.
   클래스 반복 = (0,3,0) 확보 (T58-D04 패턴): .sheet-overlay .qty-sheet__thumb img(0,2,1) 등
   화면 규칙이 로드 순서 무관하게 지도록. */
.img-placeholder .img-placeholder__symbol.img-placeholder__symbol {
  width: 40%;
  max-width: 44px;
  height: auto;
  object-fit: contain;
  opacity: 0.55;
}
.top-bar__actions { display: flex; gap: var(--space-1); }
/* 터치 타깃 44px (TASK-086 H3) — 히트 박스를 --size-touch-min으로 키우고 음수 마진으로
   플로우 footprint(24px)·아이콘 광학 위치를 유지. 팝오버 앵커(.notif 박스 24px)도 불변. */
.top-bar__btn {
  width: var(--size-touch-min);
  height: var(--size-touch-min);
  margin: calc((var(--size-icon-lg) - var(--size-touch-min)) / 2);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--color-fg);
  display: flex;
  align-items: center;
  justify-content: center;
}
/* 알림 팝오버 (TASK-044 ⑤ — 아이콘 아래 앵커된 둥근 사각 말풍선, 중앙 모달 아님).
   .notif = 벨 버튼 기준 앵커(relative), 팝오버는 우측 정렬로 아래에 뜬다. */
.notif { position: relative; display: flex; }
.notif-popover {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  z-index: 50;
  min-width: 200px;
  max-width: 260px;
  padding: var(--space-4);
  background: var(--color-bg);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
}
.notif-popover[hidden] { display: none; }
/* 말풍선 꼬리 (벨 아이콘을 향해 위로) */
.notif-popover::before {
  content: "";
  position: absolute;
  top: -5px;
  right: 12px;
  width: 10px;
  height: 10px;
  background: var(--color-bg);
  border-left: var(--border-width) solid var(--color-border);
  border-top: var(--border-width) solid var(--color-border);
  transform: rotate(45deg);
}
.notif-popover__empty {
  margin: 0;
  font-size: var(--font-size-sm);
  color: var(--color-fg-subtle);
  text-align: center;
  white-space: nowrap;
}
/* 미읽음 목록 (TASK-046 — placeholder 승격. 항목 = button_to 폼(읽음 POST), 클릭 시 문의 이동) */
/* 미읽음 점 표시 (2026-07-19 유저 확정 — 숫자·9+ 뱃지 폐기) */
.notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--color-red-500);
  border: 1.5px solid var(--color-bg);
}
.notif-list {
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 60vh;
  overflow-y: auto;
}
.notif-list__item + .notif-list__item { border-top: var(--border-width) solid var(--color-border); }
.notif-list__item form { margin: 0; }
.notif-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: var(--space-2-5, 10px) var(--space-1);
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}
.notif-item__title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-fg);
}
.notif-item__ref {
  font-size: var(--font-size-xs);
  color: var(--color-fg-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notif-item__time {
  font-size: var(--font-size-xs);
  color: var(--color-fg-subtle);
}

/* Home Content */
.home-content { background: var(--color-bg); padding-bottom: calc(var(--size-bottomnav) + var(--safe-bottom)); }

/* Home Carousel — 큐레이션 가로 스크롤 (T35-D03). 스크롤 본체 = CSS scroll-snap(T35-D05),
   TASK-102 ①에서 마우스·펜 드래그 스크롤만 carousel 컨트롤러로 추가(터치는 여전히 네이티브).
   touch-action: pan-x는 걸지 않는다 — 피드 중간 띠라 세로 페이지 스크롤 시작점이 된다 (T102-D03). */
.home-carousel {
  display: flex;
  gap: var(--space-3);
  padding: 0 var(--space-page) var(--space-4);
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scroll-padding: 0 var(--space-page);
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.home-carousel::-webkit-scrollbar { display: none; }
/* 카드 이미지·전면 링크의 네이티브 드래그 차단 (TASK-102 ① — 고스트가 상하·영역 밖으로 끌려나감) */
.home-carousel img,
.home-carousel a { -webkit-user-drag: none; }
/* 카드 폭 44% — 2장 + 다음 카드 일부 노출(스크롤 힌트) */
.home-carousel > .product-card {
  flex: 0 0 44%;
  scroll-snap-align: start;
}

/* Section */
.section__header { display: flex; align-items: center; justify-content: space-between; padding: var(--space-5) var(--space-page) var(--space-3); }
.section__title { font-size: var(--font-size-base); font-weight: var(--font-weight-semibold); color: var(--color-fg); line-height: var(--line-height-normal); }
.section__more {
  display: flex; align-items: center; gap: var(--space-0-5);
  font-size: var(--font-size-md); font-weight: var(--font-weight-medium); color: var(--color-fg-subtle);
  text-decoration: none;
  /* 터치 타깃 (TASK-086 H3) — 라인박스(~20px)를 패딩으로 44px+ 확장, 음수 마진으로 레이아웃 불변 */
  padding: var(--space-3-5) var(--space-2);
  margin: calc(-1 * var(--space-3-5)) calc(-1 * var(--space-2));
}
.section-divider { height: 8px; background: var(--color-bg-muted); }

/* Campaign List */
.campaign-list { display: flex; flex-direction: column; gap: 18px; padding: 0 var(--space-page) var(--space-6); }

/* Product Card — stretched-link: __link::after가 카드 전면 커버, 찜 버튼은 z-index로 위 */
.product-card { position: relative; }
.product-card__link { color: inherit; text-decoration: none; }
.product-card__link::after { content: ""; position: absolute; inset: 0; }
.product-card__image-wrap {
  position: relative; width: 100%; height: 265px;
  background: var(--color-bg-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  color: var(--color-gray-500);
}
.product-card__image-wrap img { width: 100%; height: 100%; object-fit: cover; }
.product-card__badges {
  position: absolute;
  top: var(--space-2-5); left: var(--space-2-5); right: var(--space-2-5);
  display: flex; justify-content: space-between; align-items: flex-start;
}
.product-card__heart {
  /* 터치 타깃 44px (TASK-086 H3) — 박스 34→44 확대분만큼 inset을 당겨 아이콘 중심 근사 유지 */
  position: absolute; bottom: var(--space-1); right: var(--space-1);
  z-index: 1;
  width: var(--size-touch-min); height: var(--size-touch-min);
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--color-bg);
  display: flex; align-items: center; justify-content: center;
}
.product-card__info { padding: var(--space-3) var(--space-0-5) 0; }
.product-card__farm {
  display: flex; align-items: center; gap: var(--space-1);
  color: var(--color-fg-subtle);
  font-size: var(--font-size-xs); font-weight: var(--font-weight-medium);
  line-height: var(--line-height-tight);
  margin-bottom: var(--space-0-5);
}
/* #16 (TASK-058): 농원명 앞 위치 아이콘(13px, _product_card ERB에서 지정)이 좁은 카드에서 눌리지 않게 고정 */
.product-card__farm svg { flex-shrink: 0; }
.product-card__title {
  font-size: var(--font-size-base); font-weight: var(--font-weight-semibold);
  color: var(--color-fg); line-height: var(--line-height-normal);
  margin-bottom: var(--space-1);
}
/* TASK-079 ②: 카드 태그 줄 — 항상 1줄 (2줄로 감기면 좌우 카드 가격줄이 21px 어긋남). 상한 초과는 "+N" chip.
   긴 태그명은 chip이 줄어들며 잘리게 두고(min-width:0) 줄바꿈은 막는다 — 카드 높이 안정이 우선. */
.product-card__tag-row { display: flex; flex-wrap: nowrap; gap: var(--space-1); overflow: hidden; }
.product-card__tag-row .chip { min-width: 0; overflow: hidden; }
.product-card__price-row { display: flex; align-items: baseline; gap: 6px; padding-top: var(--space-2-5); }
.product-card__price-original { font-size: var(--font-size-sm); font-weight: var(--font-weight-regular); color: var(--color-fg-faint); text-decoration: line-through; }
.product-card__price-discount { font-size: var(--font-size-md); font-weight: var(--font-weight-medium); color: var(--color-fg-brand-strong); }
.product-card__price-sale { font-size: var(--font-size-lg); font-weight: var(--font-weight-semibold); color: var(--color-fg); }

/* Badge */
.badge { display: inline-flex; align-items: center; padding: var(--space-0-5) var(--space-2); border-radius: var(--radius-sm); font-size: var(--font-size-xs); font-weight: var(--font-weight-medium); line-height: var(--line-height-tight); white-space: nowrap; }
.badge--brand    { background: var(--color-bg-brand-solid); color: var(--color-fg-on-brand); }
.badge--dark     { background: var(--color-overlay-card);   color: var(--color-fg-on-brand); }
.badge--success  { background: var(--color-bg-success);     color: var(--color-fg-success-strong); }
.badge--critical { background: var(--color-bg-critical);    color: var(--color-fg-critical-strong); }

/* Chip */
.chip { display: inline-flex; align-items: center; padding: var(--space-0-5) var(--space-2); border-radius: var(--radius-sm); background: var(--color-bg-subtle); font-size: var(--font-size-xs); font-weight: var(--font-weight-medium); color: var(--color-fg-subtle); line-height: var(--line-height-tight); white-space: nowrap; }
.chip--brand { background: var(--color-bg-brand); color: var(--color-fg-brand-strong); }

/* Progress Bar */
.progress-section { display: flex; flex-direction: column; gap: 6px; padding-top: var(--space-2-5); }
/* TASK-061 (#7-1 확정): 'N명 참여' 제거 → 달성률만. __participants 규칙 제거 완료. */
.progress-section__meta { display: flex; font-size: var(--font-size-xs); font-weight: var(--font-weight-medium); line-height: var(--line-height-tight); }
.progress-section__rate         { color: var(--color-fg-brand-strong); }
.progress-bar { width: 100%; height: 6px; background: var(--color-border); border-radius: var(--radius-full); overflow: hidden; }
.progress-bar__fill { height: 100%; background: var(--color-fg-brand); border-radius: var(--radius-full); }

/* Bottom Nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, var(--layout-mobile-width));
  z-index: 30; /* 스크롤 콘텐츠(카드 하트 z-index:1)보다 위, FAB(40)·팝오버(50) 아래 */
  display: flex; align-items: stretch;
  height: var(--size-bottomnav);
  background: var(--color-bg);
  border-top: var(--border-width) solid var(--color-border);
  /* 자립 스타일 (TASK-088) — 뷰마다 .app-shell 안/밖 렌더 위치가 달라 상속이 갈렸다.
     밖이면 body(스타일 없음)에서 시스템 폰트·UA 검정을 물려받아 페이지별로 폰트가 달라 보였다. */
  font-family: var(--font-sans);
  color: var(--color-fg);
}
.bottom-nav__tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--space-1); text-decoration: none; color: var(--color-fg-muted);
}
.bottom-nav__tab.is-active { color: var(--color-fg-brand-strong); }
.bottom-nav__tab-icon { width: var(--size-icon-lg); height: var(--size-icon-lg); display: flex; align-items: center; justify-content: center; position: relative; }
.bottom-nav__label { font-size: var(--font-size-xs); font-weight: var(--font-weight-medium); line-height: var(--line-height-tight); }

/* 문의 FAB (TASK-049 — Figma 172-1699. 하단 네비 위 우하단, 쉘 폭 기준 정렬) */
.home-fab {
  position: fixed;
  bottom: calc(var(--size-bottomnav) + var(--safe-bottom) + var(--space-4));
  /* 쉘(--layout-mobile-width)이 뷰포트보다 좁으면 쉘 우측 모서리 기준, 아니면 화면 여백 기준 */
  right: max(var(--space-page), calc((100% - var(--layout-mobile-width)) / 2 + var(--space-page)));
  z-index: 40; /* .notif-popover(50) 아래 */
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--color-bg-brand-solid);
  color: var(--color-fg-on-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-float);
}

/* Styleguide Page */
.sg { max-width: var(--layout-mobile-width); margin: 0 auto; padding: var(--space-6) var(--space-page); font-family: var(--font-sans); background: var(--color-bg); min-height: 100vh; }
.sg__title { font-size: var(--font-size-xl); font-weight: var(--font-weight-bold); color: var(--color-fg); margin-bottom: var(--space-6); }
.sg__section { margin-bottom: var(--space-8); }
.sg__section-title { font-size: var(--font-size-base); font-weight: var(--font-weight-semibold); color: var(--color-fg); border-bottom: var(--border-width) solid var(--color-border); padding-bottom: var(--space-2); margin-bottom: var(--space-4); }
.sg__row { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: flex-end; margin-bottom: var(--space-3); }
.sg__swatch-wrap { display: flex; flex-direction: column; align-items: center; gap: var(--space-1); }
.sg__swatch { width: 44px; height: 44px; border-radius: var(--radius-md); border: var(--border-width) solid var(--color-border); }
.sg__label { font-size: 9px; color: var(--color-fg-subtle); text-align: center; line-height: 1.3; }

/* 랜딩 이동 롤링 배너 (TASK-066 ① — 구 .landing-cards 세로 2장을 1슬롯 자동 전환으로 교체).
   트랙 = scroll-snap 가로 스크롤(손 스와이프 = 네이티브), 자동 전환·도트 동기화 = banner_controller. */
.landing-banner { padding: var(--space-content-top) var(--space-page) 0; } /* top = 헤더-본문 표준 간격 (TASK-099 — 기존 16px 값 유지, 토큰만 교체) */
.landing-banner__track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  border-radius: var(--radius-lg); /* 슬라이드 모서리 = 트랙에서 클립(카드 반경과 동일) */
  scrollbar-width: none;
}
.landing-banner__track::-webkit-scrollbar { display: none; }
/* 슬라이드 = 기존 .landing-card 표현 그대로, 폭만 1슬롯(100%) */
.landing-banner__slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
}
/* 도트 = 트랙 아래(슬라이드 클릭 영역 밖). 버튼 44×44 = 탭 타깃(--size-touch-min, TASK-086 H3),
   시각 도트는 ::before — 음수 마진으로 세로 footprint는 구 20px 유지 */
.landing-banner__dots {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: var(--space-2);
}
.landing-banner__dot {
  width: var(--size-touch-min);
  height: var(--size-touch-min);
  margin: calc((20px - var(--size-touch-min)) / 2) 0;
  padding: 0;
  border: none;
  background: none;
  color: inherit; /* 버튼 UA 기본 검정 차단 — 텍스트 없는 도트지만 팔레트 밖 계산값이 남는다 */
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.landing-banner__dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--color-border);
  transition: width 150ms ease, background-color 150ms ease;
}
.landing-banner__dot--active::before { width: 16px; background: var(--color-fg-brand); }
@media (prefers-reduced-motion: reduce) {
  .landing-banner__dot::before { transition: none; }
}

/* 랜딩 이동 카드 (T35-D02 구조·T42-D06 카피 — 배너 슬라이드 본문) */
.landing-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-4) var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--color-bg-brand);
  /* a 루트 — UA 링크색(#0000EE)·16px 상속 차단 (TASK-086 M10, .product-card__link color:inherit와 동일 취지) */
  color: var(--color-fg);
  font-size: var(--font-size-base);
  text-decoration: none;
}
.landing-card--reward { background: var(--color-bg-subtle); }
.landing-card__tag {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  color: var(--color-fg-brand-strong);
}
.landing-card--reward .landing-card__tag { color: var(--color-fg-muted); }
.landing-card__title {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--color-fg);
  line-height: var(--line-height-normal);
}
/* #3 (TASK-058): '더 알아보기' 화살표 우측 정렬 — 텍스트/화살표를 flex 양끝 배치 */
.landing-card__cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--color-fg-muted);
}
.landing-card__cta-arrow { flex-shrink: 0; }
