/* objects.cubesphere.xyz — 모바일 우선. 기본이 2열 그리드다. */

:root {
  --bg: #0b0d12;
  --surface: #151922;
  --surface-2: #1d222d;
  --line: #262c39;
  --fg: #e9edf5;
  --fg-dim: #98a2b8;
  --fg-mute: #6b7486;
  --accent: #ff5a3c;
  --radius: 14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
               "Pretendard", "Noto Sans KR", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  padding-bottom: env(safe-area-inset-bottom);
}

a { color: inherit; text-decoration: none; }

/* ── 헤더 ───────────────────────────────────────────────── */
.hdr {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(11, 13, 18, .93);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
  padding: max(10px, env(safe-area-inset-top)) 12px 8px;
}

.hdr-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.01em;
}

/* 원형으로 잘라낸 크림색 배지. 다크 배경 위에 '코인'처럼 얹힌다. */
.logo-mark {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: block;
  flex: 0 0 auto;
  /* 크림 배경이 다크 위에서 붕 뜨지 않도록 얇은 링을 준다. */
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .1);
}

.logo-text { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace; }
.logo-text .dot { color: var(--accent); }

.count { font-size: 12px; color: var(--fg-mute); }

/* ── 검색 ───────────────────────────────────────────────── */
.search {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.search-ico {
  position: absolute;
  left: 12px;
  width: 17px; height: 17px;
  fill: none;
  stroke: var(--fg-mute);
  stroke-width: 2;
  stroke-linecap: round;
  pointer-events: none;
}

.search input {
  width: 100%;
  height: 42px;
  padding: 0 40px 0 36px;
  border: 1px solid var(--line);
  border-radius: 21px;
  background: var(--surface);
  color: var(--fg);
  /* iOS 자동 확대를 막으려면 16px 이상이어야 한다. */
  font-size: 16px;
  outline: none;
}
.search input:focus { border-color: var(--accent); }
.search input::placeholder { color: var(--fg-mute); }
.search input::-webkit-search-cancel-button { filter: invert(.6); }

.spin {
  position: absolute; right: 14px;
  width: 15px; height: 15px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  opacity: 0;
  transition: opacity .15s;
}
.htmx-request .spin, .spin.htmx-request { opacity: 1; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── 칩 ─────────────────────────────────────────────────── */
.chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 6px;
  margin: 0 -12px;
  padding-left: 12px;
  padding-right: 12px;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  padding: 7px 13px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-dim);
  white-space: nowrap;
}
.chip.on { background: var(--fg); border-color: var(--fg); color: #0b0d12; }
.chip.sm { font-size: 12px; padding: 5px 11px; font-weight: 500; }
.vendors { padding-bottom: 2px; }

/* ── 카드 그리드: 모바일 2열 ────────────────────────────── */
.cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 12px;
}

@media (min-width: 560px) { .cards { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 820px) {
  .cards { grid-template-columns: repeat(4, 1fr); max-width: 1100px; margin: 0 auto; }
  .hdr { max-width: 1100px; margin: 0 auto; }
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .12s ease;
}
.card:active { transform: scale(.975); }

/* ── 썸네일 ─────────────────────────────────────────────── */
.thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--surface-2);
  overflow: hidden;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.noimg {
  display: flex; align-items: center; justify-content: center;
  height: 100%; font-size: 12px; color: var(--fg-mute);
}

/* 썸네일 상단은 상품 이미지의 밝은 텍스트와 배지가 겹치기 쉽다.
   배지 뒤에 그라데이션을 깔아 대비를 확보한다. */
.thumb::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 46px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, .55), transparent);
  pointer-events: none;
  z-index: 1;
}

.no {
  position: absolute; top: 6px; left: 6px;
  z-index: 2;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(0, 0, 0, .82);
  border: 1px solid rgba(255, 255, 255, .16);
  font-size: 11px; font-weight: 700;
  letter-spacing: .03em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .8);
}

.hot {
  position: absolute; top: 6px; right: 6px;
  z-index: 2;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--accent);
  font-size: 10px; font-weight: 800;
  box-shadow: 0 1px 6px rgba(0, 0, 0, .4);
}

/* ── 카드 정보 ──────────────────────────────────────────── */
.info { padding: 9px 10px 11px; display: flex; flex-direction: column; gap: 4px; }

.vendor {
  align-self: flex-start;
  font-size: 10px;
  font-weight: 700;
  color: var(--vc, var(--fg-dim));
  border: 1px solid color-mix(in srgb, var(--vc, #6b7280) 45%, transparent);
  background: color-mix(in srgb, var(--vc, #6b7280) 14%, transparent);
  padding: 1px 6px;
  border-radius: 5px;
}

.title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  /* 2줄로 고정해 카드 높이를 맞춘다. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: keep-all;
}

.sub {
  margin: 0;
  font-size: 11px;
  color: var(--fg-mute);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--fg-mute);
  margin-top: 1px;
}
.star { color: #ffb020; font-weight: 700; }
.ship { color: #34d399; font-weight: 600; }

/* ── 기타 ───────────────────────────────────────────────── */
.empty { padding: 60px 20px; text-align: center; color: var(--fg-mute); font-size: 14px; }

.more { padding: 4px 12px 24px; }
.more-btn {
  display: block;
  padding: 13px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  font-size: 14px;
  font-weight: 600;
  color: var(--fg-dim);
}

.ftr {
  border-top: 1px solid var(--line);
  padding: 18px 14px calc(24px + env(safe-area-inset-bottom));
  color: var(--fg-mute);
}
.disc { margin: 0 0 6px; font-size: 11px; line-height: 1.5; }
.copy { margin: 12px 0 0; font-size: 11px; }
