/* Comdex — one stylesheet, no framework.
 *
 * The whole site is a few page types showing dense numeric data, which a
 * utility framework would make heavier and no easier to change. Everything is
 * driven by the custom properties below; dark mode redefines those and nothing
 * else. Fonts are a system stack with a CJK fallback so Chinese renders in the
 * reader's own UI face rather than waiting on a 4MB webfont.
 */

:root {
  color-scheme: light dark;

  --bg: #fbfbfa;
  --surface: #ffffff;
  --surface-2: #f4f4f2;
  --border: #e3e3df;
  --border-strong: #cfcfc9;

  --text: #1c1c1a;
  --text-muted: #6b6b65;
  --text-faint: #97978f;

  --accent: #b5401f;          /* a HK-red leaning terracotta, used sparingly */
  --accent-soft: #fdf0eb;
  --link: #12507a;

  --good: #1f6b3f;            /* price down / in stock */
  --good-soft: #eaf5ee;
  --warn: #8a5a10;
  --warn-soft: #fdf3e2;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(20, 20, 15, .05), 0 4px 14px rgba(20, 20, 15, .04);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          "PingFang HK", "Noto Sans CJK HK", "Microsoft JhengHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;

  --wrap: 1160px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16161a;
    --surface: #1e1e23;
    --surface-2: #26262c;
    --border: #33333b;
    --border-strong: #45454f;
    --text: #ececea;
    --text-muted: #a3a3a0;
    --text-faint: #7a7a78;
    --accent: #ec7a52;
    --accent-soft: #33211c;
    --link: #7bb8e0;
    --good: #5fc98a;
    --good-soft: #17301f;
    --warn: #d4a24a;
    --warn-soft: #2e2413;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
  }
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.22; margin: 0 0 .4em; font-weight: 650; letter-spacing: -.011em; }
h1 { font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.1rem); }
h2 { font-size: 1.2rem; }
img { max-width: 100%; height: auto; display: block; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }

.skip {
  position: absolute; left: -9999px;
  background: var(--surface); padding: 10px 16px; z-index: 100; border-radius: var(--radius-sm);
}
.skip:focus { left: 12px; top: 12px; }

/* --- header ------------------------------------------------------------- */

.site-head {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.head-row { display: flex; align-items: center; gap: 18px; height: 58px; }
.brand { font-weight: 700; font-size: 1.15rem; letter-spacing: -.02em; color: var(--text); }
.brand span { color: var(--accent); }
.brand:hover { text-decoration: none; }

.search { flex: 1; max-width: 460px; position: relative; }
.search input {
  width: 100%; padding: 8px 12px; font: inherit; font-size: 14px;
  border: 1px solid var(--border-strong); border-radius: 999px;
  background: var(--bg); color: var(--text);
}
.search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.head-right { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: 13.5px; }
.lang-switch { display: flex; gap: 2px; background: var(--surface-2); padding: 3px; border-radius: 999px; }
.lang-switch a { padding: 3px 10px; border-radius: 999px; color: var(--text-muted); font-size: 12.5px; }
.lang-switch a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.lang-switch a:hover { text-decoration: none; color: var(--text); }

/* Category strip: scrolls sideways on a phone rather than wrapping to
   three lines and pushing the content below the fold. */
.cat-strip { border-bottom: 1px solid var(--border); background: var(--surface); }
.cat-strip ul {
  display: flex; gap: 4px; list-style: none; margin: 0; padding: 7px 0;
  overflow-x: auto; scrollbar-width: none;
}
.cat-strip ul::-webkit-scrollbar { display: none; }
.cat-strip a {
  display: block; white-space: nowrap; padding: 5px 11px; border-radius: 999px;
  color: var(--text-muted); font-size: 13.5px;
}
.cat-strip a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.cat-strip a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* --- layout blocks ------------------------------------------------------ */

main { padding: 26px 0 64px; }
.stack > * + * { margin-top: 26px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.section-head h2 { margin: 0; }
.section-head a { font-size: 13.5px; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-pad { padding: 18px; }

.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.small { font-size: 13px; }
.tnum { font-variant-numeric: tabular-nums; }

.crumbs { font-size: 13px; color: var(--text-muted); margin-bottom: 14px; }
.crumbs a { color: var(--text-muted); }
.crumbs span { margin: 0 6px; color: var(--text-faint); }

/* --- product grid ------------------------------------------------------- */

.grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
@media (min-width: 640px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
}
.pcard {
  display: flex; flex-direction: column; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  transition: border-color .12s ease, transform .12s ease;
}
.pcard:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.pcard-main { display: block; color: inherit; }
.pcard-main:hover { text-decoration: none; }

/* Every thumbnail occupies exactly the same box whatever the source image is
   shaped like. Product photography arrives as tall retail boxes, wide bare
   cards and square press shots; without a fixed ratio and `contain`, each card
   sets its own height and the grid rows go ragged. */
.pcard .thumb {
  aspect-ratio: 4 / 3; background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  padding: 10px; overflow: hidden;
}
.pcard .thumb picture,
.pcard .thumb img {
  display: block; width: 100%; height: 100%;
  object-fit: contain;          /* never crop a product, never stretch it */
  object-position: center;
}
.pcard .thumb img { mix-blend-mode: multiply; }
.thumb .no-image { width: 44%; height: auto; color: var(--text-faint); }
@media (prefers-color-scheme: dark) { .pcard .thumb img { mix-blend-mode: normal; } }

.pcard .name {
  padding: 11px 12px 0;
  font-size: 13.5px; color: var(--text); line-height: 1.35; font-weight: 500;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
  /* Two lines' worth whether the name needs one or two, so the price rows of
     adjacent cards line up instead of stepping. */
  min-height: calc(2 * 1.35em);
}

.pcard-meta {
  display: flex; flex-wrap: wrap; gap: 5px; padding: 8px 12px 0;
}
.pcard-meta .tag {
  font-size: 11.5px; line-height: 1.6; padding: 1px 7px;
  border: 1px solid var(--border); border-radius: 999px;
  color: var(--text-muted); background: var(--bg); white-space: nowrap;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.pcard-meta .tag:hover {
  border-color: var(--accent); color: var(--accent); text-decoration: none;
}

.pcard-foot { display: block; margin-top: auto; padding: 8px 12px 13px; color: inherit; }
.pcard-foot:hover { text-decoration: none; }
.pcard .price { font-size: 17px; font-weight: 680; letter-spacing: -.02em; color: var(--link); }
.pcard .shops { font-size: 12px; color: var(--text-faint); }

.badge {
  display: inline-block; padding: 2px 7px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .01em;
}
.badge-drop { background: var(--good-soft); color: var(--good); }
.badge-high { background: var(--warn-soft); color: var(--warn); }
.badge-flat { background: var(--surface-2); color: var(--text-muted); }

/* --- product page ------------------------------------------------------- */

.product-top { display: grid; gap: 24px; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); }
@media (max-width: 760px) { .product-top { grid-template-columns: 1fr; } }
.hero-img {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center; padding: 22px;
}

.price-panel { display: flex; flex-wrap: wrap; gap: 10px 30px; align-items: flex-end; margin: 14px 0 6px; }
.price-now { font-size: clamp(1.9rem, 1.4rem + 2vw, 2.6rem); font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.price-stat { font-size: 13px; color: var(--text-muted); }
.price-stat b { display: block; font-size: 15.5px; color: var(--text); font-weight: 620; }

/* --- tables ------------------------------------------------------------- */

.table-scroll { overflow-x: auto; }
table.offers { width: 100%; border-collapse: collapse; font-size: 14px; }
table.offers th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-faint); font-weight: 600; padding: 0 12px 8px; white-space: nowrap;
}
table.offers td { padding: 11px 12px; border-top: 1px solid var(--border); vertical-align: middle; }
table.offers tr:first-child td { border-top: 1px solid var(--border-strong); }
table.offers .best td { background: var(--good-soft); }
table.offers .price-cell { font-weight: 660; font-size: 15px; white-space: nowrap; }
.flag { font-size: 15px; margin-right: 5px; }
.stock-in { color: var(--good); }
.stock-out { color: var(--text-faint); }

.btn {
  display: inline-block; padding: 6px 13px; border-radius: var(--radius-sm);
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap;
}
.btn:hover { text-decoration: none; filter: brightness(1.07); }
.btn-quiet { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }

/* --- chart -------------------------------------------------------------- */

.chart { width: 100%; height: auto; display: block; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .axis-label { fill: var(--text-faint); font-size: 11px; font-family: var(--font); }
.chart .series-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .series-area { fill: var(--accent); opacity: .07; }
.chart .dot { fill: var(--accent); }

/* --- specs -------------------------------------------------------------- */

.specs { width: 100%; border-collapse: collapse; font-size: 14px; }
.specs th {
  text-align: left; font-weight: 500; color: var(--text-muted);
  padding: 9px 14px 9px 0; width: 40%; border-top: 1px solid var(--border); vertical-align: top;
}
.specs td { padding: 9px 0; border-top: 1px solid var(--border); }

/* --- filters / toolbar -------------------------------------------------- */

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.toolbar select, .toolbar .chip {
  font: inherit; font-size: 13.5px; padding: 6px 11px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
}
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }

.pager { display: flex; gap: 8px; justify-content: center; margin-top: 28px; }
.pager a, .pager span {
  padding: 6px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); font-size: 13.5px; color: var(--text-muted);
}
.pager .on { background: var(--surface); color: var(--text); font-weight: 600; }

/* --- footer ------------------------------------------------------------- */

.site-foot {
  border-top: 1px solid var(--border); background: var(--surface);
  padding: 38px 0 26px; font-size: 13px; color: var(--text-muted);
}

/* The brand block takes twice the width of a link column, then the columns
   share what is left. Collapses to two columns on a tablet and one on a
   phone, where a five-column footer is unreadable. */
.foot-grid {
  display: grid; gap: 28px 24px;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  align-items: start;
}
@media (max-width: 900px) { .foot-grid { grid-template-columns: 1fr 1fr 1fr; } }
@media (max-width: 560px) { .foot-grid { grid-template-columns: 1fr 1fr; } }

.foot-brand .brand { font-size: 1.1rem; }
.foot-brand .foot-slogan {
  margin: 6px 0 10px; font-size: 13.5px; font-weight: 600; color: var(--text);
}
.foot-brand p.small { max-width: 42ch; line-height: 1.65; }
@media (max-width: 560px) { .foot-brand { grid-column: 1 / -1; } }

.foot-col h3 {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-faint); font-weight: 600; margin: 0 0 10px;
}
.foot-col ul { list-style: none; margin: 0; padding: 0; }
.foot-col li { margin-bottom: 7px; line-height: 1.35; }
.foot-col a { color: var(--text-muted); }
.foot-col a:hover { color: var(--text); }
.foot-plain li { color: var(--text-muted); }

/* The second category column continues the first, so its heading is a spacer
   that keeps the lists aligned without announcing an empty section. */
.sr-only-head { visibility: hidden; }
@media (max-width: 900px) { .sr-only-head { display: none; } }

.foot-legal {
  margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--border);
}
.disclaimer { max-width: 62ch; line-height: 1.6; }

.empty-state { text-align: center; padding: 56px 20px; color: var(--text-muted); }
