:root {
  --bg: #ffffff;
  --panel: #f5f5f7;
  --panel-soft: #fbfbfd;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --muted-light: #86868b;
  --line: #d2d2d7;
  --line-soft: #e8e8ed;
  --blue: #0071e3;
  --blue-hover: #0077ed;
  --radius: 24px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body:has(dialog[open]) {
  overflow: hidden;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
}

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

img,
svg {
  display: block;
  max-width: 100%;
}

h1,
h2,
p {
  margin: 0;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

/* nav */
.site-nav {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 50;
  height: 48px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}

.nav-inner {
  display: flex;
  width: 100%;
  max-width: 1440px;
  height: 100%;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
}

.wordmark {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav-links a,
.nav-links button {
  padding: 4px 0;
  color: var(--ink);
  font-size: 12px;
  letter-spacing: 0.01em;
  opacity: 0.82;
  transition: opacity 0.2s ease;
}

.nav-links a:hover,
.nav-links button:hover {
  opacity: 1;
}

/* hero */
main {
  padding-top: 48px;
}

.hero {
  display: flex;
  max-width: 900px;
  margin: 0 auto;
  padding: 82px 24px 62px;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.hero-kicker {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  line-height: 1.4;
}

.hero h1 {
  margin-top: 12px;
  font-size: clamp(48px, 7vw, 80px);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 1.04;
}

.hero-lede {
  margin-top: 18px;
  color: var(--muted);
  font-size: clamp(16px, 2vw, 21px);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.45;
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
  color: var(--muted-light);
  font-size: 12px;
}

.meta-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--line);
}

/* catalog */
.catalog {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 28px 96px;
}

.catalog-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding: 28px 0 20px;
}

.catalog-head h2 {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.035em;
}

.catalog-caption {
  color: var(--muted-light);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
}

.transit-head {
  margin-top: 50px;
  padding-top: 38px;
  border-top: 1px solid var(--line-soft);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.product-grid:empty {
  display: none;
}

.product-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--panel);
  animation: card-in 0.55s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.product-image {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

.product-image img {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 82%;
  height: 84%;
  object-fit: contain;
  transform: translate(-50%, -50%);
  transition: transform 0.55s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.product-card:hover .product-image img {
  transform: translate(-50%, -50%) scale(1.018);
}

.product-image img.blend-image {
  mix-blend-mode: multiply;
}

.image-fallback {
  display: flex;
  width: 78%;
  height: 78%;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: #e8e8ed;
  color: var(--muted-light);
  font-size: 13px;
  letter-spacing: 0.08em;
}

.transit-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  backdrop-filter: blur(8px);
}

.product-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 2px 24px 24px;
}

.product-collection {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-ref {
  margin-top: 4px;
  color: var(--ink);
  font-family: "SF Mono", "SFMono-Regular", ui-monospace, Menlo, monospace;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.product-variant {
  margin-top: 7px;
  min-height: 22px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.product-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 0;
  margin-top: 7px;
}

.product-tag {
  padding: 3px 6px;
  border-radius: 5px;
  background: #e8e8ed;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.25;
}

.prices {
  display: grid;
  margin-top: auto;
  padding-top: 18px;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.price-block {
  min-width: 0;
}

.price-block + .price-block {
  padding-left: 16px;
  border-left: 1px solid rgba(0, 0, 0, 0.08);
}

.price-label {
  display: block;
  color: var(--muted-light);
  font-size: 10px;
  letter-spacing: 0.02em;
  line-height: 1.3;
}

.price-value {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--ink);
  font-size: clamp(17px, 1.8vw, 21px);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.price-value.is-cny {
  color: var(--ink);
}

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

/* skeleton */
.skeleton-card {
  min-height: 480px;
  border-radius: var(--radius);
  background: linear-gradient(100deg, #f5f5f7 20%, #fbfbfd 40%, #f5f5f7 60%);
  background-size: 220% 100%;
  animation: skeleton 1.5s linear infinite;
}

@keyframes skeleton {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -100% 0;
  }
}

/* footer */
.site-footer {
  background: var(--panel);
}

.footer-inner {
  width: 100%;
  max-width: 700px;
  margin: 0 auto;
  padding: 44px 24px 54px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
  text-align: center;
}

.footer-inner p + p {
  margin-top: 4px;
}

.footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 22px;
  color: var(--muted-light);
  font-size: 11px;
}

.footer-links a {
  color: var(--muted);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
}

/* AI dialog */
.ai-dialog {
  width: min(520px, calc(100vw - 32px));
  max-width: 100%;
  max-height: min(720px, calc(100dvh - 48px));
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 30px 100px -20px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.ai-dialog::backdrop {
  background: rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(4px);
}

.ai-dialog[open] {
  animation: dialog-in 0.3s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.ai-panel {
  display: flex;
  max-height: min(720px, calc(100dvh - 48px));
  flex-direction: column;
}

.ai-head {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--line-soft);
}

.ai-kicker {
  color: var(--muted-light);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
}

.ai-head h2 {
  margin-top: 3px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.ai-close {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: var(--panel);
  color: var(--muted);
}

.ai-close:hover {
  background: #e8e8ed;
  color: var(--ink);
}

.ai-close svg {
  width: 14px;
  height: 14px;
}

.ai-messages {
  display: flex;
  min-height: 260px;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding: 20px 22px;
  scrollbar-width: thin;
}

.ai-message {
  max-width: 88%;
  padding: 11px 14px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.ai-message-bot {
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  background: var(--panel);
  color: var(--ink);
}

.ai-message-user {
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  background: var(--blue);
  color: #fff;
}

.ai-message-loading {
  display: flex;
  width: 52px;
  gap: 4px;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.ai-message-loading span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted-light);
  animation: typing 1.2s ease-in-out infinite;
}

.ai-message-loading span:nth-child(2) {
  animation-delay: 0.15s;
}

.ai-message-loading span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typing {
  0%,
  60%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

.ai-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.ai-suggestions button {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  transition: border-color 0.2s, color 0.2s;
}

.ai-suggestions button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.ai-form {
  display: flex;
  flex: none;
  gap: 8px;
  padding: 14px 18px 18px;
  border-top: 1px solid var(--line-soft);
}

.ai-form input {
  width: 100%;
  min-width: 0;
  height: 42px;
  flex: 1;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  outline: 0;
  font-size: 13px;
  transition: border-color 0.2s, background 0.2s;
}

.ai-form input:focus {
  border-color: var(--blue);
  background: #fff;
}

.ai-form button {
  height: 42px;
  flex: none;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
}

.ai-form button:hover {
  background: var(--blue-hover);
}

.ai-form button:disabled {
  opacity: 0.4;
  cursor: default;
}

/* responsive */
@media (max-width: 1100px) {
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .catalog {
    padding-right: 22px;
    padding-left: 22px;
  }
}

@media (max-width: 700px) {
  .nav-inner {
    padding: 0 20px;
  }

  .nav-links {
    gap: 22px;
  }

  .hero {
    padding: 54px 20px 42px;
  }

  .hero h1 {
    font-size: clamp(44px, 12.5vw, 62px);
  }

  .hero-lede {
    margin-top: 14px;
    font-size: 16px;
  }

  .hero-meta {
    margin-top: 18px;
  }

  .catalog {
    padding: 8px 14px 70px;
  }

  .catalog-head {
    padding: 24px 8px 16px;
  }

  .catalog-head h2 {
    font-size: 24px;
  }

  .transit-head {
    margin-top: 36px;
    padding-top: 30px;
  }

  .product-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .product-card {
    border-radius: 20px;
  }

  .product-image {
    aspect-ratio: 1 / 0.96;
  }

  .product-body {
    padding: 0 20px 20px;
  }

  .price-value {
    font-size: 20px;
  }

  .site-footer {
    margin-top: 0;
  }

  .footer-inner {
    padding: 36px 24px 44px;
  }

  .ai-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    border-radius: 20px;
  }

  .ai-panel {
    max-height: calc(100dvh - 16px);
  }

  .ai-messages {
    min-height: 220px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
