/* Public directory page. */

/* Taobao-style orange band. Text sits on white pills: white text on this
   orange would only reach about 2.3:1 contrast. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--taobao-gradient);
  box-shadow: 0 1px 0 rgb(150 40 0 / 0.15);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 68px;
}

.band-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 6px 14px 6px 8px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgb(150 40 0 / 0.18);
}

.band-brand {
  padding-right: 18px;
}

.band-platforms {
  display: flex;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.band-platforms .platform-logo {
  width: 24px;
  height: 24px;
  border-radius: 6px;
}

.site-header :focus-visible {
  box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--text);
}

/* ---- Hero ---------------------------------------------------------------- */

.hero {
  padding: clamp(48px, 9vw, 96px) 0 clamp(36px, 6vw, 56px);
}

.eyebrow {
  margin-bottom: 14px;
  color: var(--accent-text);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 20ch;
  font-family: var(--font-serif);
  font-size: clamp(34px, 5.4vw, 54px);
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.08;
}

.hero-lede {
  max-width: 54ch;
  margin-top: 18px;
  color: var(--text-muted);
  font-size: clamp(16px, 1.8vw, 18px);
}

.search {
  position: relative;
  max-width: 560px;
  margin-top: 32px;
}

.search svg {
  position: absolute;
  top: 50%;
  left: 16px;
  width: 18px;
  height: 18px;
  color: var(--text-subtle);
  transform: translateY(-50%);
  pointer-events: none;
}

.search .input {
  min-height: 52px;
  padding-left: 46px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  font-size: 16px;
}

/* ---- Toolbar & filters --------------------------------------------------- */

.directory {
  padding-bottom: 80px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding: 20px 0;
  border-top: 1px solid var(--border);
}

/* One scrollable row, so a long category list never dominates the page. */
.filters {
  display: flex;
  flex: 1;
  gap: 8px;
  min-width: 0;
  padding: 3px 2px;
  overflow-x: auto;
  scrollbar-width: none;
  mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent);
}

.filters::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: none;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.chip:hover {
  border-color: var(--text-subtle);
  color: var(--text);
}

.chip[aria-pressed='true'] {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.result-count {
  color: var(--text-subtle);
  font-size: 14px;
  white-space: nowrap;
}

/* ---- Grid & cards -------------------------------------------------------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 20px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.card {
  --card-pad: 22px;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: var(--card-pad);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

/* Product picture, edge to edge across the top of the card */
.card-media {
  margin: calc(-1 * var(--card-pad)) calc(-1 * var(--card-pad)) 18px;
  overflow: hidden;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface-muted);
  aspect-ratio: 4 / 3;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.card-title {
  min-width: 0;
}

.card h3 {
  font-size: 18px;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.card-domain {
  margin-top: 2px;
  color: var(--text-subtle);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.card-desc {
  margin-top: 16px;
  color: var(--text-muted);
  font-size: 15px;
}

.card .tag-list {
  margin-top: 16px;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 20px;
}

.visit-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  color: var(--accent-text);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.visit-link:hover {
  background: var(--accent);
  color: #fff;
}

.visit-link svg {
  width: 14px;
  height: 14px;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.copy-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.copy-link:hover {
  border-color: var(--text-subtle);
  color: var(--text);
}

.copy-icon {
  display: inline-flex;
}

.copy-icon .icon {
  width: 15px;
  height: 15px;
}

.copy-link.is-copied {
  border-color: var(--accent);
  color: var(--accent-text);
}

/* Loading skeletons */
.card.skeleton {
  pointer-events: none;
}

.skeleton .bone {
  border-radius: 6px;
  background: var(--surface-muted);
  animation: pulse 1.4s ease-in-out infinite;
}

.skeleton .bone {
  display: block;
  height: 12px;
  margin-top: 12px;
}

.skeleton .card-head .bone {
  margin-top: 0;
}

.skeleton .bone-logo {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
}

.skeleton .bone-title {
  width: 55%;
  height: 16px;
}

.skeleton .card-head + .bone {
  margin-top: 22px;
}

.skeleton .bone-line-short {
  width: 60%;
}

.skeleton .bone-button {
  width: 112px;
  height: 38px;
  margin-top: 28px;
}

@keyframes pulse {
  50% {
    opacity: 0.55;
  }
}

/* ---- Empty / error states ------------------------------------------------ */

.state {
  max-width: 440px;
  margin: 40px auto 0;
  padding: 40px 24px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  text-align: center;
}

.state h2 {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 500;
}

.state p {
  margin-top: 8px;
  color: var(--text-muted);
}

.state .btn {
  margin-top: 20px;
}

.state-page {
  margin-top: 15vh;
}

/* ---- Footer: disclaimer (+ cookie settings when analytics is on) -------- */

.site-footer {
  padding: 40px 0;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.disclaimer {
  max-width: 78ch;
  scroll-margin-top: 92px; /* clear the sticky top band when linked to */
}

.disclaimer:focus {
  outline: none;
}

.disclaimer h2 {
  font-size: 15px;
  letter-spacing: 0.01em;
}

.disclaimer p {
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
}

.disclaimer strong {
  color: var(--text);
}

.site-footer .link-button {
  margin-top: 18px;
}

/* Short risk notice under the search box */
.risk-note {
  max-width: 560px;
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 14px;
}

.risk-note a {
  color: var(--accent-text);
  font-weight: 600;
  white-space: nowrap;
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-muted);
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.link-button:hover {
  color: var(--text);
}

/* Phones: platform pills become icon-only so the band stays one line.
   The names stay available to screen readers and as tooltips. */
@media (max-width: 720px) {
  .band-platforms {
    gap: 6px;
  }

  .band-platforms .band-pill {
    padding: 6px;
  }

  .band-platform-name {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

@media (max-width: 380px) {
  .band-brand .brand-name {
    font-size: 15px;
  }

  .band-platforms .band-pill {
    min-height: 38px;
    padding: 5px;
  }

  .band-platforms .platform-logo {
    width: 22px;
    height: 22px;
  }
}

@media (max-width: 560px) {
  .toolbar {
    align-items: flex-start;
    flex-direction: column;
    flex-wrap: nowrap;
  }

  .filters {
    flex: none;
    width: calc(100% + 2 * var(--gutter));
    margin: 0 calc(-1 * var(--gutter));
    padding: 3px var(--gutter);
  }

  .card {
    --card-pad: 18px;
  }
}

/* ---- Platform on cards --------------------------------------------------- */

.card-platform {
  margin-top: 4px;
}

/* ---- WhatsApp button ----------------------------------------------------- */

.whatsapp-fab {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 20px 7px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  box-shadow: 0 4px 14px rgb(var(--ink) / 0.16);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, bottom 0.2s ease;
}

.whatsapp-fab:hover {
  border-color: #25d366;
  box-shadow: 0 6px 20px rgb(var(--ink) / 0.22);
  transform: translateY(-1px);
}

.whatsapp-fab:focus-visible {
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px #128c7e;
}

/* Text stays dark on white: white on WhatsApp green is only ~2:1 contrast. */
.whatsapp-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #25d366; /* WhatsApp brand green */
  color: #fff;
}

.whatsapp-icon svg {
  width: 24px;
  height: 24px;
}

.whatsapp-text {
  display: grid;
  line-height: 1.25;
}

.whatsapp-kicker {
  color: var(--text-muted);
  font-size: 12px;
}

.whatsapp-cta {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

/* Keep the end of the page clear of the floating button. */
.has-fab .site-footer {
  padding-bottom: 112px;
}

/* ---- Analytics consent --------------------------------------------------- */

.consent {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 40;
  width: min(400px, calc(100% - 40px));
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
}

.consent-title {
  font-size: 15px;
}

.consent p {
  margin-top: 6px;
  color: var(--text-muted);
}

.consent-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}


@media (max-width: 640px) {
  .whatsapp-fab {
    right: max(16px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom));
    gap: 10px;
    padding: 6px 16px 6px 6px;
  }

  .whatsapp-icon {
    width: 38px;
    height: 38px;
  }

  .whatsapp-icon svg {
    width: 22px;
    height: 22px;
  }

  .consent {
    left: 0;
    bottom: 0;
    width: 100%;
    padding-bottom: max(18px, env(safe-area-inset-bottom));
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  /* Lift the WhatsApp button above the consent sheet while it is open. */
  .consent-open .whatsapp-fab {
    bottom: calc(var(--consent-height, 160px) + 12px);
  }
}
