/* ChaBazaar · Hanging scroll product card (立軸 lìzhóu)
   Framework-neutral. All selectors are prefixed .sc- to avoid collisions.
   Fonts expected on the page: "EB Garamond" (500, 600, italic 500) and "Noto Serif SC" (500).
   Body text inherits the site's own sans-serif. */

:root {
  /* brand */
  --sc-ink: #3d2614;          /* primary text */
  --sc-brown: #5b3a22;        /* lines, icons, buttons */
  --sc-muted: #7a6250;        /* meta text (5:1 on paper) */
  --sc-paper: #fbf8f2;        /* card face */
  --sc-silk: #e6d7bd;         /* mount border around the paper */
  --sc-rod-top: #7a5233;      /* rod gradient */
  --sc-rod-bottom: #3d2614;
  --sc-on-class: #fbf6ec;     /* text on a class-colored chip */

  /* tea classes: the six classes 六大茶類 liù dà chálèi, plus Pǔ'ěr as its own class */
  --sc-class-hong: #9a3b26;   /* 紅茶 hóngchá  · black tea  */
  --sc-class-lv: #4f6e2f;     /* 綠茶 lǜchá    · green tea  */
  --sc-class-bai: #6f6a5f;    /* 白茶 báichá   · white tea  */
  --sc-class-huang: #85651a;  /* 黃茶 huángchá · yellow tea */
  --sc-class-qing: #2f6b62;   /* 青茶 qīngchá  · oolong     */
  --sc-class-hei: #3b2a20;    /* 黑茶 hēichá   · dark tea (Liù Bǎo, Fú brick, …) */
  --sc-class-puer: #6e2e3a;   /* 普洱 pǔ'ěr    · Pǔ'ěr, shú and shēng (its own card class) */
  --sc-class-none: #5b3a22;   /* fallback when the class is unknown */

  --sc-serif: "EB Garamond", Garamond, "Times New Roman", serif;
  --sc-cjk: "Noto Serif SC", "Noto Serif TC", "Songti SC", "PMingLiU", serif;
}

/* ---------- grid: 4–5 per row on desktop, wraps down to 1 on phones ---------- */
.sc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  /* column gap must stay ≥ 24px: the rods overhang each card by 10px per side */
  gap: 28px 28px;
  align-items: stretch;
  padding-inline: 10px; /* room for the outer rods on the first and last columns */
}
.sc-grid-single {
  grid-template-columns: minmax(220px, 280px);
  justify-content: start;
}

/* ---------- card ---------- */
.sc-card {
  --sc-class: var(--sc-class-none);
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  color: var(--sc-ink);
  transition: transform 180ms ease;
}
.sc-card[data-tea-class="hong"]  { --sc-class: var(--sc-class-hong); }
.sc-card[data-tea-class="lv"]    { --sc-class: var(--sc-class-lv); }
.sc-card[data-tea-class="bai"]   { --sc-class: var(--sc-class-bai); }
.sc-card[data-tea-class="huang"] { --sc-class: var(--sc-class-huang); }
.sc-card[data-tea-class="qing"]  { --sc-class: var(--sc-class-qing); }
.sc-card[data-tea-class="hei"]   { --sc-class: var(--sc-class-hei); }
.sc-card[data-tea-class="puer"]  { --sc-class: var(--sc-class-puer); }

.sc-card:hover { transform: translateY(-2px); }
@media (prefers-reduced-motion: reduce) { .sc-card { transition: none; } .sc-card:hover { transform: none; } }

/* hanging cord + rods */
.sc-hook { display: block; margin: 0 auto -1px; color: var(--sc-brown); }
.sc-rod {
  display: block;
  height: 9px;
  margin-inline: -8px;
  border-radius: 5px;
  background: linear-gradient(var(--sc-rod-top), var(--sc-rod-bottom));
}
.sc-rod--bottom { height: 11px; margin-inline: -10px; }

/* silk mount and paper */
.sc-mount {
  flex: 1; display: flex; padding: 8px; background: var(--sc-silk);
  transition: background-color 180ms ease;
}
/* hover/focus: the silk mount takes on a wash of the card's tea-class color */
.sc-card:hover .sc-mount,
.sc-card:focus-within .sc-mount {
  background: color-mix(in srgb, var(--sc-class) 22%, var(--sc-silk));
}
@media (prefers-reduced-motion: reduce) { .sc-mount { transition: none; } }
.sc-paper {
  position: relative;
  flex: 1;
  display: flex;
  gap: 8px;
  padding: 12px 10px 10px 12px;
  background: var(--sc-paper);
  box-shadow: 0 0 0 1px rgba(91, 58, 34, 0.12);
}
.sc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }

/* drag handle (wire to the site's existing reorder behavior) */
.sc-handle {
  position: absolute; top: 6px; right: 8px;
  padding: 2px 4px; border: 0; background: none; cursor: grab;
  font-size: 14px; line-height: 1; letter-spacing: -1px; color: #a08670;
}
.sc-handle:active { cursor: grabbing; }

/* text */
.sc-title {
  margin: 0;
  font-family: var(--sc-serif);
  font-size: 17px; line-height: 1.15; font-weight: 600;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.sc-meta {
  margin: 0;
  font-size: 10px; line-height: 1.35; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--sc-muted);
}
.sc-price { margin: auto 0 0; /* pins price and icons to the bottom so rows line up */ font-size: 11px; letter-spacing: 0.08em; color: var(--sc-muted); }
.sc-amount {
  margin-right: 2px;
  font-family: var(--sc-serif); font-size: 22px; font-weight: 600; letter-spacing: 0;
  color: var(--sc-ink);
  font-variant-numeric: tabular-nums;
}

/* attribute tiles */
.sc-attrs { display: flex; flex-wrap: nowrap; gap: 3px; margin: 0; padding: 0; list-style: none; }
.sc-attr {
  position: relative;
  width: 27px; height: 27px; box-sizing: border-box; flex: none;
  display: flex; align-items: center; justify-content: center;
  border-radius: 7px;
}
.sc-attr svg { width: 16px; height: 16px; }
.sc-attr.is-known { background: rgba(91, 58, 34, 0.09); border: 1px solid transparent; color: var(--sc-brown); }
.sc-attr.is-unknown { border: 1px dashed rgba(91, 58, 34, 0.4); color: rgba(91, 58, 34, 0.45); }
.sc-q { position: absolute; right: 3px; bottom: 1px; font-size: 10px; font-weight: 700; line-height: 1; color: var(--sc-muted); }
.sc-badge {
  position: absolute; top: -6px; right: -6px;
  min-width: 17px; height: 17px; padding: 0 4px; box-sizing: border-box;
  display: flex; align-items: center; justify-content: center;
  border-radius: 9px;
  background: var(--sc-class); color: var(--sc-on-class);
  font-size: 10px; font-weight: 600;
}

/* footer helpers (Open CTA kept for brand kit; reviews live in the side rail) */
.sc-foot { padding-top: 4px; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.sc-open {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  border: 1px solid var(--sc-brown); border-radius: 3px;
  font-size: 13px; font-weight: 600; text-decoration: none;
  color: var(--sc-brown);
}
.sc-open:hover { background: var(--sc-brown); color: var(--sc-paper); }
.sc-reviews-label {
  margin: 8px 0 2px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sc-muted);
}
.sc-open:focus-visible, .sc-reviews-btn:focus-visible, .sc-handle:focus-visible {
  outline: 2px solid var(--sc-class); outline-offset: 2px;
}

/* vertical class column (right edge) */
.sc-side {
  width: 24px; flex: none;
  padding: 14px 0 2px 6px;
  border-left: 1px dotted rgba(91, 58, 34, 0.35);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.sc-vzh {
  writing-mode: vertical-rl;
  font-family: var(--sc-cjk); font-size: 16px; line-height: 1; letter-spacing: 0.28em;
  color: var(--sc-class);
}
.sc-seal {
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 2px;
  background: var(--sc-class); color: var(--sc-on-class);
  font-family: var(--sc-cjk); font-size: 11px; line-height: 1;
}
.sc-reviews-btn {
  margin-top: auto;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: rgba(91, 58, 34, 0.09);
  color: var(--sc-brown);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.sc-reviews-btn:hover {
  background: rgba(91, 58, 34, 0.16);
}
.sc-reviews-btn svg {
  width: 14px;
  height: 14px;
}

/* screen-reader-only text */
.sc-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ChaBazaar wiring: product image, title/dealer links, good-deal chip */
.sc-product-image {
  display: block;
  width: 100%;
  max-height: 96px;
  object-fit: cover;
  border-radius: 2px;
}
.sc-title-link {
  color: inherit;
  text-decoration: none;
}
.sc-title-link:hover { text-decoration: underline; }
.sc-dealer-link {
  color: inherit;
  text-decoration: none;
}
.sc-dealer-link:hover { text-decoration: underline; }
.sc-attr img { width: 16px; height: 16px; }
.sc-deal {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--sc-class);
  color: var(--sc-on-class);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: middle;
}
.sc-card.cha3-card-dragging { opacity: 0.7; }
.sc-card.cha3-card-drag-over .sc-paper {
  box-shadow: 0 0 0 2px var(--sc-class);
}
