/* kakobuysheet.io — hand-written stylesheet
   White ground, ink-navy text, low-saturation rust action colour.
   No framework, no external fonts, no CDN. */

:root {
  --font: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --bg-panel: #fbfaf8;
  --ink: #14213a;
  --ink-soft: #33405a;
  --muted: #5b6472;
  --line: #e4e7ec;
  --line-strong: #cfd4dc;
  --rust: #a4461a;
  --rust-dark: #863711;
  --rust-tint: #f7ede6;
  --focus: #1f5fbf;
  --maxw: 1200px;
  --radius: 10px;
  --radius-sm: 7px;
}

* { box-sizing: border-box; }

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

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

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

a { color: var(--rust); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--rust-dark); }

h1, h2, h3 { color: var(--ink); margin: 0; text-wrap: balance; }
h1 { font-size: 48px; font-weight: 800; line-height: 1.15; letter-spacing: -0.02em; }
h2 { font-size: 28px; font-weight: 700; line-height: 1.3; }
h3 { font-size: 18px; font-weight: 600; line-height: 1.4; }
p { margin: 0; }

small, .small { font-size: 14px; }

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

.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: 20px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  z-index: 200;
  border-radius: 0 0 6px 0;
}
.skip-link:focus { left: 0; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 62px;
  padding-block: 8px;
}
.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.brand .brand-mark { color: var(--rust); }
.brand .brand-tld { color: var(--muted); font-weight: 600; font-size: 13px; }

.main-nav { margin-left: auto; }
.main-nav ul {
  list-style: none;
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 0;
}
.main-nav a {
  display: inline-block;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  border-radius: var(--radius-sm);
}
.main-nav a:hover { background: var(--bg-soft); color: var(--ink); }
.main-nav a[aria-current="page"] { color: var(--rust); background: var(--rust-tint); }

.nav-toggle {
  display: none;
  margin-left: auto;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
}

/* ---------- Search form ---------- */
.search-form { display: flex; gap: 8px; width: 100%; }
.search-form .search-input {
  flex: 1 1 auto;
  min-width: 0;
  font-family: inherit;
  font-size: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
}
.search-form .search-input:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary { background: var(--rust); color: #fff; }
.btn-primary:hover { background: var(--rust-dark); color: #fff; }
.btn-secondary { background: #fff; color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--bg-soft); color: var(--ink); }
.btn-block { width: 100%; }
.search-note { font-size: 13px; color: var(--muted); margin-top: 8px; }

/* ---------- Page layout / section rhythm ---------- */
main { display: block; }
.page { padding-block: 40px 64px; }
.page > section + section { margin-top: 56px; }
.section-head { margin-bottom: 20px; }
.section-head h2 { margin-bottom: 8px; }
.section-head p { color: var(--muted); max-width: 70ch; }

/* ---------- Hero ---------- */
.hero { padding-block: 48px 8px; }
.hero .hero-inner { max-width: 760px; }
.hero p.lede {
  font-size: 18px;
  color: var(--ink-soft);
  margin-top: 16px;
  max-width: 60ch;
}
.hero .search-form { margin-top: 24px; max-width: 620px; }

/* ---------- Catalogue layout ---------- */
.catalogue-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}
.cat-sidebar {
  position: sticky;
  top: 78px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--bg-panel);
}
.cat-sidebar h2 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 12px; }
.cat-sidebar ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.cat-sidebar a {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 500;
}
.cat-sidebar a:hover { background: #fff; color: var(--ink); }
.cat-sidebar a[aria-current="page"] { background: var(--rust-tint); color: var(--rust); }
.cat-sidebar .count { color: var(--muted); font-variant-numeric: tabular-nums; }
.cat-sidebar a[aria-current="page"] .count { color: var(--rust); }

/* Category chips (mobile / home) */
.cat-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.cat-chips a {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  text-decoration: none;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  background: #fff;
}
.cat-chips a:hover { border-color: var(--rust); color: var(--rust); }
.cat-chips a .count { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }

/* ---------- Product grid ---------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}
.product-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.product-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: #fff;
  transition: border-color .12s ease;
}
.product-card:hover { border-color: var(--line-strong); }
.product-card .thumb {
  aspect-ratio: 1 / 1;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 12px;
}
.product-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-card .p-cat {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 5px;
}
.product-card h3 { font-size: 15px; font-weight: 600; line-height: 1.4; margin-bottom: 8px; }
.product-card h3 a { color: var(--ink); text-decoration: none; }
.product-card h3 a:hover { color: var(--rust); text-decoration: underline; }
.product-card .price {
  margin-top: auto;
  padding-top: 8px;
  font-size: 14px;
}
.product-card .price .usd { font-weight: 700; color: var(--ink); }
.product-card .price .cny { color: var(--muted); }
.product-card .card-actions { margin-top: 12px; display: flex; flex-direction: column; gap: 7px; }
.product-card .card-actions .btn { padding: 9px 12px; font-size: 14px; }

.blocked-flag {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

/* ---------- Product detail ---------- */
.product-detail {
  display: grid;
  grid-template-columns: minmax(0, 440px) minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}
.product-media {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-soft);
}
.product-media img { width: 100%; height: auto; }
.product-info h1 { font-size: 32px; line-height: 1.2; }
.product-info .p-cat { margin-bottom: 10px; }
.price-block {
  margin-top: 20px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-panel);
}
.price-block .usd-big { font-size: 24px; font-weight: 800; color: var(--ink); }
.price-block .cny-line { color: var(--ink-soft); margin-top: 4px; }
.price-block .fx-note { font-size: 13px; color: var(--muted); margin-top: 10px; }
.detail-actions { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 12px; }
.detail-actions .btn { flex: 1 1 200px; }
.detail-meta { margin-top: 24px; }
.detail-meta dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; }
.detail-meta dt { color: var(--muted); font-size: 14px; }
.detail-meta dd { margin: 0; font-size: 14px; }

/* ---------- Notices ---------- */
.notice {
  border: 1px solid var(--line);
  border-left: 3px solid var(--rust);
  background: var(--rust-tint);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 14px;
  color: var(--ink-soft);
}
.notice.plain { border-left-color: var(--line-strong); background: var(--bg-soft); }
.notice strong { color: var(--ink); }
.affiliate-line {
  font-size: 13px;
  color: var(--muted);
  margin-top: 10px;
}

/* ---------- Breadcrumb ---------- */
.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 18px; }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.breadcrumb li::after { content: "/"; margin-left: 6px; color: var(--line-strong); }
.breadcrumb li:last-child::after { content: ""; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--rust); }

/* ---------- Prose / articles ---------- */
.prose { max-width: 70ch; }
.prose h2 { margin-top: 40px; margin-bottom: 12px; }
.prose h3 { margin-top: 28px; margin-bottom: 8px; }
.prose p { margin-bottom: 16px; }
.prose ul, .prose ol { margin: 0 0 16px; padding-left: 22px; }
.prose li { margin-bottom: 8px; }
.prose li::marker { color: var(--muted); }
.prose a { font-weight: 500; }
.lead { font-size: 18px; color: var(--ink-soft); }

.card-list { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.link-card {
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  text-decoration: none;
  background: #fff;
}
.link-card:hover { border-color: var(--rust); }
.link-card h3 { color: var(--ink); margin-bottom: 6px; }
.link-card p { color: var(--muted); font-size: 14px; }

/* ---------- FAQ ---------- */
.faq-item { border-top: 1px solid var(--line); padding: 20px 0; }
.faq-item:last-child { border-bottom: 1px solid var(--line); }
.faq-item h3 { margin-bottom: 8px; }
.faq-item p { color: var(--ink-soft); max-width: 72ch; }
.faq-item .src { font-size: 13px; color: var(--muted); margin-top: 8px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; font-size: 14px; }
table.data th, table.data td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
table.data th { color: var(--muted); font-weight: 600; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  margin-top: 72px;
  padding-block: 40px 32px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 28px;
}
.footer-grid h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 12px; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.footer-grid a { font-size: 14px; color: var(--ink-soft); text-decoration: none; }
.footer-grid a:hover { color: var(--rust); text-decoration: underline; }
.footer-about p { font-size: 14px; color: var(--muted); max-width: 40ch; }
.footer-bottom {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  justify-content: space-between;
}

/* ---------- 404 ---------- */
.error-page { text-align: center; padding-block: 80px; }
.error-page h1 { font-size: 40px; }
.error-page p { color: var(--muted); margin-top: 12px; }
.error-page .actions { margin-top: 24px; display: inline-flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* ---------- Utility ---------- */
.muted { color: var(--muted); }
.stack-sm > * + * { margin-top: 12px; }
.pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--ink-soft);
  border: 1px solid var(--line);
}
.result-count { font-size: 14px; color: var(--muted); margin-bottom: 18px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  h1 { font-size: 32px; line-height: 1.2; }
  h2 { font-size: 22px; }
  h3 { font-size: 16px; }
  body { font-size: 15px; line-height: 1.6; }
  .header-inner { flex-wrap: wrap; gap: 12px; }
  .nav-toggle { display: inline-block; }
  .main-nav { margin-left: 0; width: 100%; display: none; }
  .main-nav.open { display: block; }
  .main-nav ul { flex-direction: column; gap: 2px; }
  .main-nav a { display: block; padding: 10px 12px; }
  .catalogue-layout { grid-template-columns: 1fr; gap: 24px; }
  .cat-sidebar { position: static; }
  .product-grid, .product-grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .product-card { padding: 12px; }
  .product-detail { grid-template-columns: 1fr; gap: 24px; }
  .product-info h1 { font-size: 28px; }
  .card-list { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
  .page > section + section { margin-top: 40px; }
  .hero { padding-block: 32px 4px; }
}

@media (max-width: 560px) {
  .container { padding-inline: 16px; }
  .product-grid, .product-grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .product-card .p-cat { display: none; }
  .footer-grid { grid-template-columns: 1fr; }
  .detail-actions .btn { flex: 1 1 100%; }
}

@media (max-width: 380px) {
  .product-grid, .product-grid.cols-3 { grid-template-columns: 1fr; }
}

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