/* ============================================================
 * Hengyixin Automation — main.css
 * Built for speed: ~10 KB uncompressed, ~2.5 KB Brotli.
 * No reset library. Modern CSS only. Dark mode via media query
 * (no JS). prefers-reduced-motion respected throughout.
 * ============================================================ */

:root {
  /* Brand */
  --brand: #0D47A1;
  --brand-2: #1976D2;
  --brand-3: #42A5F5;
  --accent: #FF6F00;

  /* Neutrals (light) */
  --bg: #F4F6F8;
  --surface: #FFFFFF;
  --surface-2: #F8FAFB;
  --border: #E1E6EB;
  --text: #0F1B2D;
  --text-2: #4A5867;
  --text-3: #6E7B89;

  /* Layout */
  --container: 1200px;
  --container-narrow: 760px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow-1: 0 1px 2px rgba(15,27,45,.06), 0 1px 3px rgba(15,27,45,.04);
  --shadow-2: 0 4px 12px rgba(15,27,45,.08), 0 2px 4px rgba(15,27,45,.04);
  --shadow-3: 0 10px 30px rgba(15,27,45,.12), 0 4px 8px rgba(15,27,45,.06);

  /* Typography */
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --lh-tight: 1.2;
  --lh-normal: 1.55;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a1929;
    --surface: #102436;
    --surface-2: #0d1e2e;
    --border: #1e3146;
    --text: #E6EDF5;
    --text-2: #B5C2D0;
    --text-3: #8497AA;
    --brand-3: #64B5F6;
    --shadow-1: 0 1px 2px rgba(0,0,0,.4);
    --shadow-2: 0 4px 12px rgba(0,0,0,.5);
    --shadow-3: 0 10px 30px rgba(0,0,0,.6);
  }
}

/* -----------------------------------------------------------
 * Reset (minimal, opinionated)
 * ----------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: var(--lh-normal);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
h1, h2, h3, h4, h5, h6 {
  margin: 0 0 .5em; line-height: var(--lh-tight); color: var(--text); font-weight: 700;
  overflow-wrap: break-word; word-wrap: break-word;
}
h1 { font-size: clamp(1.5rem, 5vw, 2.6rem); letter-spacing: -.015em; }
h2 { font-size: clamp(1.2rem, 3.5vw, 1.85rem); letter-spacing: -.01em; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; overflow-wrap: break-word; }
p { margin: 0 0 1em; }
a { color: var(--brand-2); text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; }
img, picture, svg, video { max-width: 100%; height: auto; display: block; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--brand-3); outline-offset: 2px; border-radius: 4px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }

/* -----------------------------------------------------------
 * Utilities
 * ----------------------------------------------------------- */
.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;
}
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--brand); color: #fff; padding: .5em 1em;
  z-index: 999;
}
.skip-link:focus { left: 1rem; top: 1rem; }

.container {
  width: 100%; max-width: var(--container);
  margin: 0 auto; padding: 0 1.25rem;
}
.container-narrow { max-width: var(--container-narrow); }

.eyebrow {
  text-transform: uppercase; letter-spacing: .12em; font-size: .78rem;
  font-weight: 700; color: var(--brand-2); margin: 0 0 .6em;
}
.section-header { text-align: center; margin-bottom: 2rem; }
.section-header p { color: var(--text-2); margin: 0; }
.section-subtitle { color: var(--text-2); margin: -.5rem 0 1.5rem; text-align: center; }
.section-cta { text-align: center; margin: 2rem 0 0; }
.section-cta a { font-weight: 600; }

/* -----------------------------------------------------------
 * Buttons
 * ----------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  padding: .7em 1.2em;
  font-weight: 600; font-size: .95rem;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  text-decoration: none; line-height: 1; white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-2); }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface); border-color: var(--text-3); }
.btn-lg { padding: 1em 1.6em; font-size: 1rem; }
.btn-sm { padding: .5em .9em; font-size: .85rem; }

/* -----------------------------------------------------------
 * Header
 * ----------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; gap: 1rem;
}
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 700; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-name { font-size: 1.05rem; letter-spacing: -.01em; }
.primary-nav { display: none; gap: 1.5rem; flex: 1; justify-content: center; }
.primary-nav a { color: var(--text-2); font-weight: 500; font-size: .95rem; }
.primary-nav a:hover { color: var(--brand); text-decoration: none; }

@media (min-width: 768px) { .primary-nav { display: inline-flex; } }

/* -----------------------------------------------------------
 * Hero
 * ----------------------------------------------------------- */
.hero {
  padding: 3rem 0 2rem;
  background:
    radial-gradient(circle at 15% 0%, color-mix(in srgb, var(--brand-3) 18%, transparent), transparent 50%),
    radial-gradient(circle at 90% 30%, color-mix(in srgb, var(--brand) 12%, transparent), transparent 60%),
    linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
}
.hero-inner { max-width: 820px; }
.hero-copy { text-align: center; margin: 0 auto; }
.hero h1 { margin-bottom: .8em; }
.lede { font-size: 1.1rem; color: var(--text-2); max-width: 60ch; margin: 0 auto 1.5rem; }
.hero-cta { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: center; margin-bottom: 1.5rem; }
.hero-trust {
  list-style: none; padding: 0; margin: 1.5rem 0 0;
  display: flex; flex-wrap: wrap; gap: 1.5rem; justify-content: center;
  font-size: .9rem; color: var(--text-3);
  max-width: 100%;
}
.hero-trust li { min-width: 0; }
.hero-trust strong { color: var(--brand); font-size: 1.15rem; display: block; }
.hero-trust li { text-align: center; }

/* -----------------------------------------------------------
 * Sections (generic)
 * ----------------------------------------------------------- */
section { padding: 3rem 0; }
section + section { border-top: 1px solid var(--border); }

/* -----------------------------------------------------------
 * Categories (home grid + cards)
 * ----------------------------------------------------------- */
.category-grid {
  list-style: none; padding: 0; margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.category-card {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--text);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.category-card:hover, .category-card:focus-visible {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
  border-color: var(--brand-3);
}
.category-card-image {
  aspect-ratio: 3/2; background: var(--surface-2); overflow: hidden;
}
.category-card-image img { width: 100%; height: 100%; object-fit: cover; }
.category-card-body { padding: 1rem 1.1rem 1.1rem; }
.category-card-body h3 { margin: 0 0 .25rem; font-size: 1.05rem; }
.category-card-body p { margin: 0; color: var(--text-3); font-size: .85rem; }

/* -----------------------------------------------------------
 * Product grid
 * ----------------------------------------------------------- */
.product-grid {
  list-style: none; padding: 0; margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1rem;
}
@media (min-width: 640px) { .product-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); } }

.product-card {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--text);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  height: 100%;
}
.product-card:hover, .product-card:focus-visible {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
  border-color: var(--brand-3);
}
.product-card-image {
  aspect-ratio: 1/1; background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  padding: .5rem;
}
.product-card-image img {
  max-width: 100%; max-height: 100%; object-fit: contain;
}
.product-card-body { padding: .75rem .9rem .9rem; display: flex; flex-direction: column; gap: .25rem; }
.product-card-sku {
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .03em;
  color: var(--text-3); margin: 0; text-transform: uppercase;
}
.product-card-title {
  margin: 0; font-size: .92rem; font-weight: 600; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-card-desc {
  margin: 0; font-size: .82rem; color: var(--text-2); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-card-cat {
  margin: .25rem 0 0; font-size: .75rem; color: var(--text-3); text-transform: uppercase;
}

/* -----------------------------------------------------------
 * Why us
 * ----------------------------------------------------------- */
.why-grid {
  list-style: none; padding: 0; margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}
.why-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
}
.why-icon {
  width: 44px; height: 44px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--brand) 12%, transparent);
  color: var(--brand); margin-bottom: 1rem;
}
.why-icon svg { width: 24px; height: 24px; }
.why-card h3 { margin: 0 0 .5rem; }
.why-card p { margin: 0; color: var(--text-2); }

/* -----------------------------------------------------------
 * FAQ
 * ----------------------------------------------------------- */
.faq-list { display: flex; flex-direction: column; gap: .5rem; }
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.faq-item summary {
  list-style: none;
  cursor: pointer;
  padding: 1rem 1.25rem;
  font-weight: 600;
  color: var(--text);
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+"; color: var(--text-3); font-weight: 400; font-size: 1.3em;
  transition: transform .2s ease;
}
.faq-item[open] summary::after { content: "−"; }
.faq-item summary:hover { color: var(--brand); }
.faq-answer { padding: 0 1.25rem 1.1rem; color: var(--text-2); }
.faq-answer p:last-child { margin-bottom: 0; }

/* -----------------------------------------------------------
 * Forms
 * ----------------------------------------------------------- */
.contact-form { display: flex; flex-direction: column; gap: 1rem; margin-top: 1.5rem; }
.form-row { display: grid; gap: 1rem; }
@media (min-width: 640px) { .form-row { grid-template-columns: 1fr 1fr; } }
.form-field { display: flex; flex-direction: column; gap: .35rem; }
.form-field > span {
  font-size: .85rem; font-weight: 600; color: var(--text-2);
}
.form-field input, .form-field textarea {
  font: inherit; color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .65rem .85rem;
  width: 100%;
}
.form-field input:focus, .form-field textarea:focus {
  outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-2) 20%, transparent);
}
.form-field textarea { resize: vertical; min-height: 120px; }
.form-aside { font-size: .85rem; color: var(--text-3); margin: -.25rem 0 0; }

/* -----------------------------------------------------------
 * Footer
 * ----------------------------------------------------------- */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 3rem 0 1.5rem;
  margin-top: 2rem;
}
.footer-inner {
  display: grid; gap: 2rem;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) { .footer-inner { grid-template-columns: 1.5fr 1fr 1fr; } }
.footer-col h3 { font-size: 1rem; margin-bottom: .75rem; color: var(--text); }
.footer-col p, .footer-col address {
  font-style: normal; color: var(--text-2); font-size: .9rem; line-height: 1.7;
}
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin-bottom: .4rem; }
.footer-col a { color: var(--text-2); }
.footer-col a:hover { color: var(--brand); }
.footer-bottom {
  margin-top: 2rem; padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center; color: var(--text-3); font-size: .85rem;
}

/* -----------------------------------------------------------
 * Breadcrumb
 * ----------------------------------------------------------- */
.breadcrumb {
  display: flex; flex-wrap: wrap; gap: .35rem;
  padding: 1.5rem 0 0;
  font-size: .9rem; color: var(--text-3);
}
.breadcrumb a { color: var(--text-2); }
.breadcrumb a:hover { color: var(--brand); }
.breadcrumb span[aria-hidden] { color: var(--text-3); }
.breadcrumb span[aria-current] { color: var(--text); font-weight: 500; }

/* -----------------------------------------------------------
 * Product page
 * ----------------------------------------------------------- */
.product-page main { padding: 0; }

.product-hero { padding: 2rem 0 3rem; }
.product-hero-grid {
  display: grid; gap: 2rem;
  grid-template-columns: 1fr;
}
@media (min-width: 900px) {
  .product-hero-grid { grid-template-columns: 1.1fr 1fr; align-items: start; gap: 3rem; }
}

.product-gallery-main {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  aspect-ratio: 1/1;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  overflow: hidden;
}
.product-gallery-main picture, .product-gallery-main img {
  display: block; max-width: 100%; max-height: 100%; object-fit: contain;
}
.product-gallery-main a { display: block; width: 100%; height: 100%; }

.product-gallery-thumbs {
  list-style: none; padding: 0; margin: 1rem 0 0;
  display: grid; gap: .5rem;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
}
.thumb {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .25rem; width: 100%; aspect-ratio: 1/1;
  cursor: pointer; opacity: .55;
  transition: opacity .15s ease, border-color .15s ease;
}
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.thumb:hover { opacity: .9; }
.thumb.is-active { opacity: 1; border-color: var(--brand-2); border-width: 2px; padding: calc(.25rem - 1px); }

.product-info h1 { font-size: clamp(1.5rem, 2.5vw + .5rem, 2rem); margin-bottom: .25rem; }
.product-sku {
  font-family: var(--font-mono); font-size: .8rem; letter-spacing: .03em;
  color: var(--text-3); text-transform: uppercase; margin: 0 0 .75rem;
}
.product-short { color: var(--text-2); font-size: 1.02rem; margin-bottom: 1.25rem; }
.product-price {
  font-size: 1.5rem; font-weight: 800; color: var(--brand);
  margin: 0 0 1.25rem;
}
.product-price-note { font-weight: 400; font-size: .85rem; color: var(--text-3); display: block; }
.product-badges {
  list-style: none; padding: 0; margin: 0 0 1.5rem;
  display: grid; grid-template-columns: 1fr 1fr; gap: .5rem;
}
.product-badges li {
  background: color-mix(in srgb, var(--brand) 8%, transparent);
  color: var(--text); padding: .55rem .75rem;
  border-radius: var(--radius-sm);
  font-size: .85rem; display: flex; align-items: center; gap: .35rem;
}
.product-badges span { color: var(--brand-2); font-weight: 800; }
.product-cta { display: flex; gap: .75rem; flex-wrap: wrap; margin-bottom: 2rem; }

.product-section {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem 1.25rem .5rem;
  margin-top: 1rem;
}
.product-section summary {
  list-style: none; cursor: default; padding-bottom: .75rem;
}
.product-section summary::-webkit-details-marker { display: none; }
.product-section h2 { margin: 0; font-size: 1.1rem; }

.feature-list {
  list-style: none; padding: 0; margin: 0 0 1rem;
  display: flex; flex-direction: column; gap: .5rem;
}
.feature-list li {
  padding-left: 1.5rem; position: relative; color: var(--text-2);
}
.feature-list li::before {
  content: "✓"; position: absolute; left: 0; color: var(--brand-2); font-weight: 700;
}

.product-body, .product-specs, .product-faq, .related, .contact-strip {
  padding: 3rem 0;
}
.product-body, .product-faq, .contact-strip, .category-intro, .category-buying, .category-faq {
  border-top: 1px solid var(--border);
}

.product-body h2, .product-faq h2, .category-intro h2, .category-buying h2, .category-faq h2, .contact-strip h2, .related h2 {
  margin-bottom: 1rem;
}

.spec-table {
  width: 100%; border-collapse: collapse;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.spec-table th, .spec-table td {
  text-align: left; padding: .8rem 1rem;
  border-bottom: 1px solid var(--border); font-size: .92rem;
  vertical-align: top;
}
.spec-table tbody tr:last-child th, .spec-table tbody tr:last-child td { border-bottom: 0; }
.spec-table th {
  width: 32%; font-weight: 600; background: var(--surface-2); color: var(--text);
}
.spec-table td { color: var(--text-2); }

.content-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: .55rem;
}
.content-list li {
  padding-left: 1.5rem; position: relative; color: var(--text-2);
  line-height: 1.6;
}
.content-list li::before {
  content: "→"; position: absolute; left: 0; color: var(--brand-2); font-weight: 700;
}
.feature-grid {
  display: grid; gap: .55rem;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) { .feature-grid { grid-template-columns: 1fr 1fr; } }

/* -----------------------------------------------------------
 * Category page
 * ----------------------------------------------------------- */
.category-page main { padding: 0; }
.category-hero { padding: 2rem 0 3rem; }
.category-hero-grid {
  display: grid; gap: 2rem;
  grid-template-columns: 1fr;
}
@media (min-width: 900px) {
  .category-hero-grid { grid-template-columns: 1.2fr 1fr; align-items: center; }
}
.category-hero h1 { font-size: clamp(1.6rem, 3vw + .5rem, 2.3rem); }
.category-hero-image {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  aspect-ratio: 3/2;
}
.category-hero-image img { width: 100%; height: 100%; object-fit: cover; }

/* -----------------------------------------------------------
 * Contact strip
 * ----------------------------------------------------------- */
.contact-strip {
  background: linear-gradient(180deg, var(--bg) 0%, var(--surface) 100%);
}
.contact-strip h2 { font-size: 1.5rem; }
.contact-strip p { color: var(--text-2); margin: 0 0 1rem; }

/* -----------------------------------------------------------
 * 404 page
 * ----------------------------------------------------------- */
.not-found-page main { padding-top: 2rem; }
.not-found { text-align: center; padding-top: 2rem; padding-bottom: 4rem; }
.not-found-code {
  font-size: clamp(5rem, 14vw, 9rem); font-weight: 800; line-height: 1;
  color: var(--brand-3); margin: 1rem 0; letter-spacing: -.04em;
}
.not-found h1 { font-size: 2rem; }
.not-found > p { color: var(--text-2); max-width: 50ch; margin: 0 auto 1.5rem; }
.not-found-cta { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; margin-bottom: 2.5rem; }
.not-found h2 { font-size: 1rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); margin-bottom: 1rem; }
.not-found-categories {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center;
}
.not-found-categories a {
  background: var(--surface); border: 1px solid var(--border);
  padding: .5rem 1rem; border-radius: 999px;
  color: var(--text); font-size: .9rem;
}
.not-found-categories a:hover { background: var(--brand); color: #fff; border-color: var(--brand); text-decoration: none; }

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

/* -----------------------------------------------------------
 * Print
 * ----------------------------------------------------------- */
@media print {
  .site-header, .site-footer, .product-cta, .contact-strip, .related, .product-gallery-thumbs { display: none; }
  body { background: #fff; color: #000; }
  a { color: #000; text-decoration: underline; }
}
