/* ============================================================
 * 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;
  background: var(--color-bg-muted);
  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 */
.page-header { background: var(--color-bg); padding-bottom: var(--space-3); flex-shrink: 0; }
.top-bar {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-page);
}
.top-bar__brand {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--color-fg-brand);
  letter-spacing: -0.3px;
  line-height: 1;
}
.top-bar__actions { display: flex; gap: var(--space-1); }
.top-bar__btn {
  width: var(--size-icon-lg);
  height: var(--size-icon-lg);
  background: none;
  border: none;
  padding: var(--space-0-5);
  cursor: pointer;
  color: var(--color-fg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.search-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: 44px;
  margin: 0 var(--space-page);
  background: var(--color-bg-subtle);
  border-radius: 10px;
  padding: 0 var(--space-3-5);
  text-decoration: none;
}
.search-bar__icon { flex-shrink: 0; color: var(--color-fg-subtle); }
.search-bar__placeholder { font-size: var(--font-size-sm); color: var(--color-fg-subtle); line-height: var(--line-height-snug); }

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

/* Hero */
.hero-wrap { padding: var(--space-1) var(--space-page); }
.hero {
  background: var(--color-carrot-200);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
}
.hero__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.hero__tag {
  display: inline-flex;
  background: var(--color-bg-brand-solid);
  color: var(--color-fg-on-brand);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  padding: var(--space-1) var(--space-2);
  border-radius: 6px;
  line-height: var(--line-height-tight);
}
.hero__title { font-size: var(--font-size-lg); font-weight: var(--font-weight-semibold); color: var(--color-fg); line-height: var(--line-height-tight); }
.hero__meta { display: flex; align-items: center; gap: 6px; }
.hero__dday {
  background: var(--color-bg-brand);
  color: var(--color-fg-brand);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  line-height: var(--line-height-tight);
}
.hero__cta { font-size: var(--font-size-sm); color: var(--color-fg-muted); line-height: var(--line-height-snug); }
.hero__image {
  width: 84px;
  height: 84px;
  background: var(--color-bg-subtle);
  border-radius: var(--radius-lg);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-gray-500);
}

/* 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;
}
.section-divider { height: 8px; background: var(--color-bg-muted); }

/* Category */
.cat-row {
  display: flex; gap: 6px;
  padding: 0 var(--space-page) var(--space-1);
  overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.cat-row::-webkit-scrollbar { display: none; }
.cat-item { display: flex; flex-direction: column; align-items: center; gap: 7px; flex-shrink: 0; cursor: pointer; }
.cat-item__icon {
  width: 52px; height: 52px;
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  background: var(--color-bg-subtle);
  color: var(--color-fg-muted);
}
.cat-item--active .cat-item__icon { background: var(--color-bg-brand); color: var(--color-fg-brand); }
.cat-item__label { font-size: var(--font-size-xs); font-weight: var(--font-weight-medium); color: var(--color-fg-muted); line-height: var(--line-height-tight); white-space: nowrap; }
.cat-item--active .cat-item__label { color: var(--color-fg); }

/* Farm Story */
.farm-row {
  display: flex; gap: var(--space-3-5);
  padding: 0 var(--space-page) var(--space-3);
  overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.farm-row::-webkit-scrollbar { display: none; }
.farm-item { display: flex; flex-direction: column; align-items: center; gap: 6px; flex-shrink: 0; cursor: pointer; }
.farm-item__avatar-ring {
  width: 64px; height: 64px;
  border-radius: var(--radius-full);
  background: var(--color-carrot-500);
  display: flex; align-items: center; justify-content: center;
}
.farm-item__avatar {
  width: 60px; height: 60px;
  border-radius: var(--radius-full);
  background: var(--color-bg-subtle);
  border: 2px solid var(--color-bg);
  display: flex; align-items: center; justify-content: center;
  color: var(--color-gray-500);
}
.farm-item__name { font-size: var(--font-size-xs); font-weight: var(--font-weight-medium); color: var(--color-fg-muted); line-height: var(--line-height-tight); white-space: nowrap; }

/* 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 {
  position: absolute; bottom: var(--space-2-5); right: var(--space-2-5);
  z-index: 1;
  width: 34px; height: 34px;
  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: 3px;
  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);
}
.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);
}
.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-gray-600); 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); }
.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: 3px var(--space-2); border-radius: 6px; 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); }
.badge--critical { background: var(--color-bg-critical);    color: var(--color-fg-critical); }

/* Chip */
.chip { display: inline-flex; align-items: center; padding: 3px 7px; 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); }

/* Progress Bar */
.progress-section { display: flex; flex-direction: column; gap: 6px; padding-top: var(--space-2-5); }
.progress-section__meta { display: flex; justify-content: space-between; 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);  }
.progress-section__participants { color: var(--color-fg-subtle); }
.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));
  display: flex; align-items: stretch;
  height: var(--size-bottomnav);
  background: var(--color-bg);
  border-top: var(--border-width) solid var(--color-border);
}
.bottom-nav__tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; text-decoration: none; color: var(--color-fg-muted);
}
.bottom-nav__tab.is-active { color: var(--color-fg-brand); }
.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); }

/* 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; }
