/* Chollo Radar — Public Landing Stylesheet (Theme tokens: dark / light / system) */
:root {
  --bg: #0c0f14;
  --bg-glow: radial-gradient(900px 420px at 14% -8%, rgba(255, 138, 42, 0.11), transparent 62%),
             radial-gradient(640px 360px at 90% -12%, rgba(229, 72, 77, 0.08), transparent 60%);
  --panel: #141922;
  --panel-2: #1b222e;
  --bar-bg: rgba(12, 15, 20, 0.84);
  --line: #252e3d;
  --line-strong: #38465c;
  --text: #edf2f7;
  --dim: #8b99ad;
  --accent: #ff8a2a;
  --accent-hover: #ff9c47;
  --accent-soft: rgba(255, 138, 42, 0.14);
  --accent-text: #160e07;
  --hot: #e5484d;
  --price: #30d158;
  --wh-bg: #ff9f0a;
  --wh-text: #160e07;
  --img-stage: #ffffff;
  --img-empty-bg: #171d28;
  --img-empty-fg: #5f6f85;
  --shadow-card: 0 10px 28px rgba(4, 7, 13, 0.45);
  --shadow-menu: 0 16px 40px rgba(3, 6, 12, 0.65);
  --radius: 8px;
  --radius-card: 14px;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  --z-sticky: 20;
  --z-dropdown: 40;
  --font: -apple-system, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f3f5f8;
    --bg-glow: radial-gradient(880px 380px at 12% -10%, rgba(255, 138, 42, 0.10), transparent 60%),
               radial-gradient(640px 320px at 92% -12%, rgba(229, 72, 77, 0.06), transparent 60%);
    --panel: #ffffff;
    --panel-2: #eaeff5;
    --bar-bg: rgba(243, 245, 248, 0.86);
    --line: #d8e0ea;
    --line-strong: #b6c3d4;
    --text: #111827;
    --dim: #526074;
    --accent: #e06d06;
    --accent-hover: #c95f00;
    --accent-soft: rgba(224, 109, 6, 0.12);
    --accent-text: #ffffff;
    --hot: #dc2626;
    --price: #0f8a3c;
    --wh-bg: #f59e0b;
    --wh-text: #1c1104;
    --img-stage: #ffffff;
    --img-empty-bg: #eef2f7;
    --img-empty-fg: #7b8ba1;
    --shadow-card: 0 8px 24px rgba(17, 24, 39, 0.08);
    --shadow-menu: 0 14px 36px rgba(17, 24, 39, 0.16);
  }
}

[data-theme="light"] {
  --bg: #f3f5f8;
  --bg-glow: radial-gradient(880px 380px at 12% -10%, rgba(255, 138, 42, 0.10), transparent 60%),
             radial-gradient(640px 320px at 92% -12%, rgba(229, 72, 77, 0.06), transparent 60%);
  --panel: #ffffff;
  --panel-2: #eaeff5;
  --bar-bg: rgba(243, 245, 248, 0.86);
  --line: #d8e0ea;
  --line-strong: #b6c3d4;
  --text: #111827;
  --dim: #526074;
  --accent: #e06d06;
  --accent-hover: #c95f00;
  --accent-soft: rgba(224, 109, 6, 0.12);
  --accent-text: #ffffff;
  --hot: #dc2626;
  --price: #0f8a3c;
  --wh-bg: #f59e0b;
  --wh-text: #1c1104;
  --img-stage: #ffffff;
  --img-empty-bg: #eef2f7;
  --img-empty-fg: #7b8ba1;
  --shadow-card: 0 8px 24px rgba(17, 24, 39, 0.08);
  --shadow-menu: 0 14px 36px rgba(17, 24, 39, 0.16);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; overflow-x: clip; }
body.pub {
  margin: 0;
  min-height: 100dvh;
  overflow-x: clip;
  background-color: var(--bg);
  background-image: var(--bg-glow);
  background-repeat: no-repeat;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.skip-link {
  position: absolute; left: -999px; top: 8px; z-index: 100;
  background: var(--accent); color: var(--accent-text);
  padding: 8px 14px; border-radius: var(--radius); font-weight: 700; text-decoration: none;
}
.skip-link:focus { left: 16px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius); }

.pub-wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 clamp(14px, 3vw, 28px);
}

/* --- Hero --- */
.pub-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 28px 0 20px;
  flex-wrap: wrap;
}
.pub-hero-in { min-width: 0; }
.pub-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  font-size: clamp(26px, 3.6vw, 38px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  text-wrap: balance;
}
.pub-brand .brand-mark { width: 42px; height: 42px; flex: 0 0 auto; display: block; }
.pub-brand em {
  font-style: normal;
  background: linear-gradient(90deg, #ff9f0a, #e5484d);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.pub-hero-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.pub-hero-sub {
  margin: 0;
  color: var(--dim);
  font-size: 14px;
  max-width: 64ch;
}
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--price);
  box-shadow: 0 0 0 3px rgba(48, 209, 88, 0.22);
}

.pub-hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Theme segmented control (Apple 8px radius) */
.theme-seg {
  display: inline-flex;
  padding: 3px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  gap: 2px;
}
.theme-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--dim);
  width: 34px;
  height: 32px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.18s var(--ease), color 0.18s var(--ease), transform 0.12s var(--ease);
}
.theme-btn:hover { color: var(--text); background: var(--panel-2); }
.theme-btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }
.theme-btn:active { transform: scale(0.95); }

.tg-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--radius);
  background: #229ed9;
  color: #ffffff;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
  transition: filter 0.18s var(--ease), transform 0.14s var(--ease);
}
.tg-cta:hover { filter: brightness(1.1); }
.tg-cta:active { transform: scale(0.97); }

/* --- Categories strip --- */
.pub-cats-wrap {
  position: relative;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}
.pub-cats-wrap::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 1px;
  width: 36px;
  pointer-events: none;
  background: linear-gradient(to right, transparent, var(--bg));
}
.pub-cats {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 36px 14px 2px;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}
.pub-cats::-webkit-scrollbar { display: none; }

.cat-chip {
  flex: 0 0 auto;
  scroll-snap-align: start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease), color 0.18s var(--ease), transform 0.12s var(--ease);
}
.cat-chip i {
  font-style: normal;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--panel-2);
  color: var(--dim);
}
.cat-chip:hover {
  border-color: var(--line-strong);
  background: var(--panel-2);
}
.cat-chip:active { transform: scale(0.97); }
.cat-chip.on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(255, 138, 42, 0.28);
}
.cat-chip.on i {
  background: rgba(0, 0, 0, 0.18);
  color: var(--accent-text);
}

/* --- Sticky filter bar (NO native selects) --- */
.pub-bar-sticky {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: var(--bar-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  margin: 0 calc(clamp(14px, 3vw, 28px) * -1) 18px;
  padding: 10px clamp(14px, 3vw, 28px);
  transition: border-color 0.2s var(--ease);
}
.pub-bar-sticky.stuck { border-bottom-color: var(--line); }

.pub-bar {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1 1 240px;
  min-width: 190px;
}
.search-ic {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--dim);
  pointer-events: none;
  display: flex;
}
.pub-q {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 40px;
  padding: 0 36px 0 38px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease);
}
.pub-q::placeholder { color: var(--dim); }
.pub-q:hover { border-color: var(--line-strong); }
.pub-q:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pub-q::-webkit-search-cancel-button,
.pub-q::-webkit-search-decoration { -webkit-appearance: none; }

.search-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--dim);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.search-clear:hover { background: var(--panel-2); color: var(--text); }
.search-clear[hidden] { display: none; }

.pub-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* Custom Dropdown Control */
.dd { position: relative; }
.dd-btn {
  appearance: none;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease), transform 0.12s var(--ease);
}
.dd-btn:hover { border-color: var(--line-strong); background: var(--panel-2); }
.dd-btn[aria-expanded="true"] { border-color: var(--accent); }
.dd-btn.active { border-color: var(--accent); background: var(--accent-soft); }
.dd-btn svg { color: var(--dim); transition: transform 0.18s var(--ease); }
.dd-btn[aria-expanded="true"] svg { transform: rotate(180deg); color: var(--accent); }

.dd-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 185px;
  padding: 6px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-menu);
  z-index: var(--z-dropdown);
  display: flex;
  flex-direction: column;
  gap: 2px;
  transform-origin: top right;
  animation: ddIn 0.15s var(--ease);
}
.dd-menu[hidden] { display: none; }
@keyframes ddIn {
  from { opacity: 0; transform: translateY(-4px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.dd-opt {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: left;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  white-space: nowrap;
}
.dd-opt:hover { background: var(--panel-2); }
.dd-opt[aria-selected="true"] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.flt-toggle {
  appearance: none;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease), color 0.18s var(--ease), transform 0.12s var(--ease);
}
.flt-toggle:hover { border-color: var(--line-strong); background: var(--panel-2); }
.flt-toggle[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
}
.flt-toggle:active { transform: scale(0.97); }

/* Active summary strip */
.pub-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--dim);
  min-height: 24px;
}
.pub-summary b { color: var(--text); font-variant-numeric: tabular-nums; }
.reset-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.reset-btn:hover { border-color: var(--accent); color: var(--accent); }
.reset-btn[hidden] { display: none; }

/* --- Product Grid --- */
.pub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(252px, 1fr));
  gap: 18px;
}

.p-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.22s var(--ease), border-color 0.22s var(--ease), box-shadow 0.22s var(--ease);
}
.p-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-card);
}

.p-img {
  position: relative;
  display: block;
  text-decoration: none;
  background: var(--img-stage);
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}
.p-img.is-empty {
  background: var(--img-empty-bg);
}
.p-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 14px;
  transition: transform 0.3s var(--ease);
}
.p-card:hover .p-img img { transform: scale(1.04); }

.p-noimg {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 100%;
  color: var(--img-empty-fg);
  font-size: 12px;
  font-weight: 500;
}
.p-noimg svg { opacity: 0.65; }

.p-drop {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--hot);
  color: #ffffff;
  font-weight: 800;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  padding: 4px 8px;
  border-radius: var(--radius);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
}
.p-drop.hot {
  background: linear-gradient(135deg, #ff9500, #e5484d);
}
.p-wh {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--wh-bg);
  color: var(--wh-text);
  font-weight: 700;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.p-body {
  padding: 14px 15px 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}
.p-title {
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  line-height: 1.42;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.84em;
  text-wrap: pretty;
}
.p-title:hover { color: var(--accent); }

.p-prices {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.p-now {
  font-size: 21px;
  font-weight: 800;
  color: var(--price);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.p-old {
  color: var(--dim);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.p-save {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}

.p-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 11px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--dim);
}
.p-src {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.p-go {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 12px;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-text);
  text-decoration: none;
  font-weight: 700;
  font-size: 12px;
  white-space: nowrap;
  transition: background 0.16s var(--ease), transform 0.12s var(--ease);
}
.p-go:hover { background: var(--accent-hover); }
.p-go:active { transform: scale(0.97); }

/* Skeletons */
.p-skel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  overflow: hidden;
  height: 340px;
}
.p-skel-img {
  aspect-ratio: 4 / 3;
  background: linear-gradient(90deg, var(--panel-2) 25%, var(--line) 50%, var(--panel-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
}
.p-skel-lines { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.p-skel-bar {
  height: 12px; border-radius: 6px; background: var(--panel-2);
}
.p-skel-bar.w70 { width: 70%; }
.p-skel-bar.w45 { width: 45%; height: 20px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Empty state & Load more */
.pub-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 56px 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  color: var(--dim);
}
.pub-empty h2 { margin: 0 0 6px; font-size: 18px; color: var(--text); }
.pub-empty p { margin: 0 0 16px; font-size: 14px; }

.pub-more { text-align: center; margin: 28px 0 12px; }
.btn-more {
  appearance: none;
  height: 42px;
  padding: 0 22px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.16s var(--ease), background 0.16s var(--ease), transform 0.12s var(--ease);
}
.btn-more:hover { border-color: var(--accent); color: var(--accent); }
.btn-more:active { transform: scale(0.97); }

/* Footer */
.pub-foot {
  border-top: 1px solid var(--line);
  margin-top: 40px;
  padding: 22px 0 40px;
  color: var(--dim);
  font-size: 12px;
  text-align: center;
  line-height: 1.7;
}
.pub-foot p { margin: 0 0 6px; max-width: 72ch; margin-inline: auto; }
.pub-foot a { color: var(--dim); text-decoration: underline; text-underline-offset: 3px; }
.pub-foot a:hover { color: var(--accent); }

/* --- Responsive: Tablet & Mobile --- */
@media (max-width: 820px) {
  .pub-hero { padding: 20px 0 16px; gap: 14px; }
  .pub-bar { gap: 8px; }
  .search-box { flex: 1 1 100%; }
  .pub-controls { width: 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .dd-btn, .flt-toggle { width: 100%; justify-content: space-between; padding: 0 10px; font-size: 12px; }
  .dd-menu { left: 0; right: auto; min-width: 170px; }
}

@media (max-width: 600px) {
  .pub-hero { align-items: stretch; flex-direction: column; padding: 16px 0 14px; }
  .pub-hero-actions { justify-content: space-between; }
  .tg-cta { flex: 1; }
  .pub-brand { font-size: 26px; }
  .pub-brand .brand-mark { width: 34px; height: 34px; }
  .pub-hero-sub { font-size: 13px; }

  .cat-chip { height: 38px; padding: 0 11px; font-size: 13px; }

  .pub-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .dd-btn, .flt-toggle { height: 40px; font-size: 13px; }
  .dd:nth-child(2) .dd-menu { left: auto; right: 0; }

  .pub-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .p-card { border-radius: 12px; }
  .p-img { aspect-ratio: 1 / 1; }
  .p-img img { padding: 10px; }
  .p-drop { top: 7px; left: 7px; font-size: 11px; padding: 3px 6px; }
  .p-wh { top: 7px; right: 7px; font-size: 10px; padding: 3px 6px; }
  .p-body { padding: 10px 10px 11px; gap: 7px; }
  .p-title { font-size: 13px; line-height: 1.35; min-height: 2.7em; }
  .p-now { font-size: 17px; }
  .p-old { font-size: 11px; }
  .p-save { display: none; }
  .p-meta { flex-direction: column; align-items: stretch; gap: 7px; padding-top: 8px; font-size: 11px; }
  .p-go { width: 100%; height: 34px; font-size: 12px; }
}

@media (max-width: 360px) {
  .pub-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
