@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&family=Noto+Sans+SC:wght@400;500;600;700&display=swap');

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

/* ─── Chinese Traditional Color Palette ─── */
:root {
  --primary: #E54D42;          /* 朱红 Vermilion */
  --primary-foreground: #fff;
  --secondary: #1772B4;        /* 琉璃蓝 Glazed Blue */
  --secondary-foreground: #fff;
  --accent: #D9B611;           /* 松花黄 Pine Yellow */
  --accent-foreground: #1C1C1C;
  --background: #F9F4EC;       /* 素白 Raw White */
  --card: #fff;
  --foreground: #1C1C1C;       /* 墨色 Ink Black */
  --muted: #F0EBE3;
  --muted-foreground: #6B6B6B;
  --border: #E2DDD5;
  --ring: #E54D42;
  --radius: 0.75rem;
}
.dark {
  --background: #0F0F0F;
  --card: #1A1A1A;
  --foreground: #EDE8DF;
  --muted: #262626;
  --muted-foreground: #9CA3AF;
  --border: #2E2E2E;
  --primary: #F06B62;
  --ring: #F06B62;
}

/* ─── Base ─── */
html {
  font-family: 'Inter', 'Noto Sans SC', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}
body {
  background: var(--background);
  color: var(--foreground);
  min-height: 100vh;
  line-height: 1.6;
}

/* 移动端可读字号与触控（减少误触与 iOS 自动放大） */
@media (max-width: 639px) {
  html {
    font-size: 100%;
  }
  body {
    font-size: 1.0625rem; /* 17px */
    line-height: 1.65;
  }
}
a {
  color: inherit;
  text-decoration: none;
}
.font-display { font-family: 'Space Grotesk', 'Noto Sans SC', sans-serif; }
.antialiased { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

/* ─── Color Utilities ─── */
.bg-background  { background: var(--background); }
.bg-card        { background: var(--card); }
.bg-muted       { background: var(--muted); }
.bg-primary     { background: var(--primary); }
.bg-secondary   { background: var(--secondary); }
.bg-accent      { background: var(--accent); }
.bg-transparent { background: transparent; }
.bg-card\/50    { background: color-mix(in srgb, var(--card) 50%, transparent); }
.bg-muted\/50   { background: color-mix(in srgb, var(--muted) 50%, transparent); }
.bg-muted\/30   { background: color-mix(in srgb, var(--muted) 30%, transparent); }
.bg-background\/80 { background: color-mix(in srgb, var(--background) 80%, transparent); }
.bg-secondary\/10  { background: color-mix(in srgb, var(--secondary) 10%, transparent); }
.bg-primary\/10 { background: color-mix(in srgb, var(--primary) 10%, transparent); }

.bg-gradient-to-r {
  background-image: linear-gradient(to right, var(--tw-gradient-stops));
}
.from-transparent {
  --tw-gradient-from: transparent;
  --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, transparent);
}
.via-border\/60 {
  --tw-gradient-stops:
    var(--tw-gradient-from),
    color-mix(in srgb, var(--border) 60%, transparent),
    var(--tw-gradient-to, transparent);
}
.to-transparent {
  --tw-gradient-to: transparent;
}

.text-foreground         { color: var(--foreground); }
.text-muted-foreground   { color: var(--muted-foreground); }
.text-primary            { color: var(--primary); }
.text-primary\/80 { color: color-mix(in srgb, var(--primary) 80%, transparent); }
.text-primary-foreground { color: var(--primary-foreground); }
.text-secondary          { color: var(--secondary); }
.text-secondary-foreground { color: var(--secondary-foreground); }
.text-accent             { color: var(--accent); }
.text-accent-foreground  { color: var(--accent-foreground); }

.border-border     { border-color: var(--border); }
.border-border\/40 { border-color: color-mix(in srgb, var(--border) 40%, transparent); }
.border-border\/60 { border-color: color-mix(in srgb, var(--border) 60%, transparent); }
.border-primary\/40 { border-color: color-mix(in srgb, var(--primary) 40%, transparent); }

/* ─── Interactive States ─── */
.hover\:bg-muted:hover    { background: var(--muted); }
.active\:bg-muted:active  { background: var(--muted); }
.hover\:bg-muted\/80:hover { background: color-mix(in srgb, var(--muted) 80%, transparent); }
.hover\:bg-primary\/90:hover { background: color-mix(in srgb, var(--primary) 90%, transparent); }
.hover\:bg-accent\/90:hover  { background: color-mix(in srgb, var(--accent) 90%, transparent); }
.hover\:text-foreground:hover { color: var(--foreground); }
.hover\:text-primary:hover    { color: var(--primary); }
.hover\:text-primary\/80:hover { color: color-mix(in srgb, var(--primary) 80%, transparent); }
.hover\:border-primary\/40:hover { border-color: color-mix(in srgb, var(--primary) 40%, transparent); }

.focus\:border-primary:focus { border-color: var(--primary); }
.focus\:outline-none:focus { outline: none; }
.focus\:ring-2:focus { box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 20%, transparent); }
.focus\:ring-primary\/20:focus { box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 20%, transparent); }

.group:hover .group-hover\:text-primary { color: var(--primary); }
.group:hover .group-hover\:opacity-100  { opacity: 1; }

/* ─── Layout Utilities ─── */
.min-h-screen { min-height: 100vh; }
.mx-auto { margin-left: auto; margin-right: auto; }
.max-w-xl { max-width: 36rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-3xl { max-width: 48rem; }
.max-w-4xl { max-width: 56rem; }
.max-w-7xl { max-width: 80rem; }
.max-w-sm { max-width: 24rem; }
.max-w-none { max-width: none; }
.w-full { width: 100%; }
.w-px { width: 1px; }
.inset-x-0 { left: 0; right: 0; }

/* Flex */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }
.grid { display: grid; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1 1 0%; }
.flex-wrap { flex-wrap: wrap; }
.shrink-0 { flex-shrink: 0; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }

.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }
.gap-10 { gap: 2.5rem; }

/* Grid */
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.col-span-full { grid-column: 1 / -1; }

/* Spacing */
.p-2 { padding: 0.5rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-2\.5 { padding-left: 0.625rem; padding-right: 0.625rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-5 { padding-left: 1.25rem; padding-right: 1.25rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-0\.5 { padding-top: 0.125rem; padding-bottom: 0.125rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-2\.5 { padding-top: 0.625rem; padding-bottom: 0.625rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.py-12 { padding-top: 3rem; padding-bottom: 3rem; }
.py-14 { padding-top: 3.5rem; padding-bottom: 3.5rem; }
.py-16 { padding-top: 4rem; padding-bottom: 4rem; }
.pt-8 { padding-top: 2rem; }
.pl-2\.5 { padding-left: 0.625rem; }
.pl-10 { padding-left: 2.5rem; }
.pr-2 { padding-right: 0.5rem; }
.pr-4 { padding-right: 1rem; }
.pr-24 { padding-right: 6rem; }
.pr-28 { padding-right: 7rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mb-12 { margin-bottom: 3rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mt-12 { margin-top: 3rem; }
.mt-16 { margin-top: 4rem; }
.ml-1 { margin-left: 0.25rem; }
.min-w-0 { min-width: 0; }
.min-h-9 { min-height: 2.25rem; }
.min-w-9 { min-width: 2.25rem; }
.min-h-11 { min-height: 2.75rem; }
.min-w-11 { min-width: 2.75rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-8 > * + * { margin-top: 2rem; }

/* Sizing */
.h-px { height: 1px; }
.h-1\.5 { height: 0.375rem; }
.h-2 { height: 0.5rem; }
.h-3 { height: 0.75rem; }
.h-3\.5 { height: 0.875rem; }
.h-4 { height: 1rem; }
.h-5 { height: 1.25rem; }
.h-6 { height: 1.5rem; }
.h-8 { height: 2rem; }
.h-10 { height: 2.5rem; }
.h-11 { height: 2.75rem; }
.h-12 { height: 3rem; }
.h-14 { height: 3.5rem; }
.h-16 { height: 4rem; }
.h-24 { height: 6rem; }
.w-1\.5 { width: 0.375rem; }
.w-2 { width: 0.5rem; }
.w-3 { width: 0.75rem; }
.w-3\.5 { width: 0.875rem; }
.w-4 { width: 1rem; }
.w-5 { width: 1.25rem; }
.w-6 { width: 1.5rem; }
.w-8 { width: 2rem; }
.w-10 { width: 2.5rem; }
.w-11 { width: 2.75rem; }
.w-12 { width: 3rem; }
.w-14 { width: 3.5rem; }
.w-16 { width: 4rem; }
.w-24 { width: 6rem; }

/* Typography */
.text-xs  { font-size: 0.75rem; line-height: 1rem; }
.text-sm  { font-size: 0.875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-lg  { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl  { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.text-4xl { font-size: 2.25rem; line-height: 2.5rem; }
.font-medium  { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold    { font-weight: 700; }
.text-center  { text-align: center; }
.text-white   { color: #fff; }
.leading-relaxed { line-height: 1.625; }
.leading-7 { line-height: 1.75rem; }
.max-w-none { max-width: none; }
.space-y-4 > * + * { margin-top: 1rem; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.list-none { list-style: none; }
.lowercase { text-transform: lowercase; }
.uppercase { text-transform: uppercase; }
.tracking-wider { letter-spacing: 0.05em; }

/* Borders & Radius */
.border   { border-width: 1px; }
.border-b { border-bottom-width: 1px; }
.border-t { border-top-width: 1px; }
.rounded-md  { border-radius: 0.375rem; }
.rounded-lg  { border-radius: var(--radius); }
.rounded-xl  { border-radius: calc(var(--radius) + 0.25rem); }
.rounded-2xl { border-radius: 1rem; }
.rounded-full { border-radius: 9999px; }

/* Effects */
.shadow-sm { box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05); }
.shadow-md { box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); }
.opacity-0 { opacity: 0; }
.object-contain { object-fit: contain; }
.overflow-hidden { overflow: hidden; }
.appearance-none { appearance: none; -webkit-appearance: none; -moz-appearance: none; }
.cursor-pointer { cursor: pointer; }
.select-none { user-select: none; }
.pointer-events-none { pointer-events: none; }

/* Position */
.relative { position: relative; }
.absolute { position: absolute; }
.sticky { position: sticky; }
.top-0   { top: 0; }
.bottom-0 { bottom: 0; }
.top-1\/2 { top: 50%; }
.left-3  { left: 0.75rem; }
.right-2 { right: 0.5rem; }
.z-50    { z-index: 50; }
.-translate-y-1\/2 { transform: translateY(-50%); }

/* Transitions & Animations */
.transition-all     { transition-property: all; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
.transition-colors  { transition-property: color, background-color, border-color; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
.transition-opacity { transition-property: opacity; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
.duration-200 { transition-duration: 200ms; }
.duration-300 { transition-duration: 300ms; }
.hover\:-translate-y-0\.5:hover { transform: translateY(-0.125rem); }
.hover\:shadow-md:hover { box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); }
.placeholder\:text-muted-foreground::placeholder { color: var(--muted-foreground); }

.prose { max-width: 65ch; }
.prose-neutral { color: var(--foreground); }
.dark .dark\:prose-invert { color: var(--foreground); }

/* Backdrop */
.backdrop-blur-lg { -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }

/* ─── Hero Gradient ─── */
.hero-gradient {
  background: linear-gradient(135deg, var(--primary) 0%, #C23A2F 35%, var(--secondary) 100%);
  position: relative;
  overflow: hidden;
}
.hero-gradient::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 80%, rgba(217,182,17,0.15) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 20%, rgba(23,114,180,0.2) 0%, transparent 60%);
  pointer-events: none;
}
.text-white\/80 { color: rgba(255,255,255,.8); }
.text-white\/70 { color: rgba(255,255,255,.7); }
.bg-white\/30   { background: rgba(255,255,255,.3); }

/* ─── 品牌卡片渐入（仅品牌网格，避免全站 .grid 误伤 Footer 等） ─── */
@keyframes brand-card-enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
[data-brand-grid] > a,
[data-featured-brands] > a,
[data-related-brands] > a {
  animation: brand-card-enter 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}
/* 使用 :nth-of-type(a) 以便网格内可穿插状态文案等非 <a> 节点（如客户端搜索摘要） */
[data-brand-grid] > a:nth-of-type(1),
[data-featured-brands] > a:nth-of-type(1),
[data-related-brands] > a:nth-of-type(1) { animation-delay: 0ms; }
[data-brand-grid] > a:nth-of-type(2),
[data-featured-brands] > a:nth-of-type(2),
[data-related-brands] > a:nth-of-type(2) { animation-delay: 55ms; }
[data-brand-grid] > a:nth-of-type(3),
[data-featured-brands] > a:nth-of-type(3),
[data-related-brands] > a:nth-of-type(3) { animation-delay: 110ms; }
[data-brand-grid] > a:nth-of-type(4),
[data-featured-brands] > a:nth-of-type(4),
[data-related-brands] > a:nth-of-type(4) { animation-delay: 165ms; }
[data-brand-grid] > a:nth-of-type(5),
[data-featured-brands] > a:nth-of-type(5),
[data-related-brands] > a:nth-of-type(5) { animation-delay: 220ms; }
[data-brand-grid] > a:nth-of-type(6),
[data-featured-brands] > a:nth-of-type(6),
[data-related-brands] > a:nth-of-type(6) { animation-delay: 275ms; }
[data-brand-grid] > a:nth-of-type(7),
[data-featured-brands] > a:nth-of-type(7),
[data-related-brands] > a:nth-of-type(7) { animation-delay: 330ms; }
[data-brand-grid] > a:nth-of-type(8),
[data-featured-brands] > a:nth-of-type(8),
[data-related-brands] > a:nth-of-type(8) { animation-delay: 385ms; }
[data-brand-grid] > a:nth-of-type(9),
[data-featured-brands] > a:nth-of-type(9),
[data-related-brands] > a:nth-of-type(9) { animation-delay: 440ms; }
[data-brand-grid] > a:nth-of-type(10),
[data-featured-brands] > a:nth-of-type(10),
[data-related-brands] > a:nth-of-type(10) { animation-delay: 495ms; }
[data-brand-grid] > a:nth-of-type(11),
[data-featured-brands] > a:nth-of-type(11),
[data-related-brands] > a:nth-of-type(11) { animation-delay: 550ms; }
[data-brand-grid] > a:nth-of-type(12),
[data-featured-brands] > a:nth-of-type(12),
[data-related-brands] > a:nth-of-type(12) { animation-delay: 605ms; }

/* ─── 搜索加载骨架屏 ─── */
@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.85; }
}
.brand-card-skeleton {
  pointer-events: none;
}
.brand-card-skeleton .skeleton-block {
  border-radius: 0.5rem;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--muted) 85%, var(--foreground)) 0%,
    color-mix(in srgb, var(--muted) 55%, var(--foreground)) 50%,
    color-mix(in srgb, var(--muted) 85%, var(--foreground)) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-pulse 1.1s ease-in-out infinite;
}
.dark .brand-card-skeleton .skeleton-block {
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--muted) 40%, transparent) 0%,
    color-mix(in srgb, var(--muted) 70%, transparent) 50%,
    color-mix(in srgb, var(--muted) 40%, transparent) 100%
  );
  background-size: 200% 100%;
}

@media (prefers-reduced-motion: reduce) {
  [data-brand-grid] > a,
  [data-featured-brands] > a,
  [data-related-brands] > a {
    animation: none;
  }
  .brand-card-skeleton .skeleton-block {
    animation: none;
    opacity: 0.55;
  }
}

/* ─── Dark mode visibility ─── */
.dark\:hidden  { display: inherit; }
.dark .dark\:hidden { display: none !important; }
.dark .dark\:block  { display: block !important; }

/* ─── Responsive ─── */
@media (min-width: 640px) {
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sm\:px-6  { padding-left: 1.5rem; padding-right: 1.5rem; }
  .sm\:py-20 { padding-top: 5rem; padding-bottom: 5rem; }
  .sm\:text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
  .sm\:text-4xl { font-size: 2.25rem; line-height: 2.5rem; }
  .sm\:text-sm { font-size: 0.875rem; line-height: 1.25rem; }
  .sm\:leading-7 { line-height: 1.75rem; }
  .sm\:mt-16 { margin-top: 4rem; }
  .sm\:p-8 { padding: 2rem; }
  .sm\:text-2xl { font-size: 1.5rem; line-height: 2rem; }
  .sm\:min-h-0 { min-height: 0; }
  .sm\:min-w-0 { min-width: 0; }
  .sm\:px-0 { padding-left: 0; padding-right: 0; }
  .sm\:py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
  .sm\:pr-24 { padding-right: 6rem; }
}
@media (min-width: 768px) {
  .md\:flex     { display: flex; }
  .md\:hidden   { display: none; }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .md\:col-span-2 { grid-column: span 2 / span 2; }
}
@media (min-width: 1024px) {
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lg\:px-8  { padding-left: 2rem; padding-right: 2rem; }
  .lg\:text-5xl { font-size: 3rem; line-height: 1; }
}

/* ─── Custom Scrollbar ─── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted-foreground); }

/* ─── Selection ─── */
::selection {
  background: color-mix(in srgb, var(--primary) 25%, transparent);
  color: var(--foreground);
}

/* ─── Details/Summary ─── */
details summary { list-style: none; }
details summary::-webkit-details-marker { display: none; }
details[open] summary::after { transform: rotate(180deg); }

/* ─── Smooth focus ring ─── */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ─── Print styles ─── */
@media print {
  .hero-gradient { background: #E54D42 !important; }
  header, footer, #theme-toggle, #lang-switcher { display: none !important; }
}
