/* Xinzhi Technology Plan B — Clean Architecture Styles
   Layered on design-taste-frontend assets/system.css.
   Never overrides .btn transform or transition (owned by assets/motion/motion.css). */

/* 1. Fix header nav overlap in EN / RU: Logo left, Links center, Actions right (never collides) */
@media (min-width: 1024px) {
  .nav.nav--split .nav__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
  }
  .nav.nav--split .nav__logo {
    position: static;
    flex-shrink: 0;
    font-size: 20px;
    white-space: nowrap;
  }
  .nav.nav--split .nav__links {
    flex: 1 1 auto;
    justify-content: center;
    gap: clamp(4px, 1vw, 14px);
    min-width: 0;
  }
  .nav.nav--split .nav__link {
    white-space: nowrap;
    padding: 0 clamp(8px, 0.9vw, 14px);
    font-size: clamp(13px, 0.95vw, 15px);
  }
  .nav.nav--split .nav__actions {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
  }
}

/* 2. Fix Hero stage aspect ratio & sharpness (keep crisp inside .wrap, no extreme ultrawide stretch) */
.hero--product .hero__stage:has(> img:not(.is-cutout), > picture) {
  margin-inline: 0 !important;
  margin-bottom: 0 !important;
  border-radius: var(--r-lg) !important;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 580px;
  min-height: 320px;
  background: var(--surface);
}
.hero--product .hero__stage > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 52%;
  display: block;
}

/* 3. Fix section & footer overlap (allow tall grids, FAQs and detail galleries to grow naturally) */
main > .hero {
  height: auto !important;
  min-height: 0 !important;
  padding-bottom: clamp(40px, 5vw, 72px);
}
main > .section,
footer.closing {
  height: auto !important;
  min-height: 0 !important;
  overflow: visible;
}
main > .section {
  padding-block: clamp(56px, 6.5vw, 96px);
}
footer.closing {
  position: relative;
  z-index: 1;
  padding-block: clamp(56px, 6vw, 88px);
}

/* 4. Put section subtitle (.muted) cleanly on its own second line */
.section-head h2 > .muted,
.section-head--split h2 > .muted {
  display: block;
  margin-top: 8px;
  font-size: clamp(17px, 1.5vw, 22px);
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: -0.01em;
}

.nav__logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-logo-img {
  height: 28px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.brand-word {
  display: flex;
  flex-direction: column;
  line-height: 1.12;
  text-align: left;
}

.brand-word__cn {
  font-size: 16px;
  font-weight: 600;
  color: #103068;
  letter-spacing: 0.05em;
}

.brand-word__en {
  font-size: 9.5px;
  font-weight: 500;
  color: #6e6a62;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: 2px;
}

footer .brand-word__cn {
  color: #f3f1ec;
}

footer .brand-word__en {
  color: #9a9d9f;
}

.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--t-small);
  font-weight: 500;
  color: var(--muted);
}

.lang-toggle button {
  background: none;
  border: 0;
  padding: 6px 8px;
  min-height: 44px;
  font: inherit;
  color: inherit;
  cursor: pointer;
  border-radius: var(--r-sm);
}

.lang-toggle button[aria-pressed="true"] {
  color: var(--ink);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* Home Hero subtle stat bar under stage */
.hero-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--gutter);
  margin-top: var(--s-5);
  padding-top: var(--s-4);
  border-top: 1px solid var(--line);
}

.hero-metrics div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hero-metrics strong {
  font-size: var(--t-h3);
  font-weight: 500;
  color: var(--ink);
}

.hero-metrics span {
  font-size: var(--t-small);
  color: var(--muted);
}

/* 3 Main Categories + 14 Sub-categories Matrix */
.cat-trio {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gutter);
}

.cat-box {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  padding-bottom: var(--s-5);
  border-bottom: 1px solid var(--line);
}

.cat-box__link {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  text-decoration: none;
  color: inherit;
}

.cat-box__media {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--surface);
}

.cat-box__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cat-box__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.cat-box__head h3 {
  margin: 0;
  font-size: var(--t-h3);
}

.cat-box__count {
  font-size: var(--t-small);
  color: var(--accent);
  font-weight: 500;
  white-space: nowrap;
}

.cat-box__spec {
  margin: 0;
  font-size: var(--t-small);
  color: var(--muted);
}

.sub-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sub-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  text-decoration: none;
  border: 1px solid transparent;
}

.sub-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Contrasting Mill Band */
.brand-band {
  background: var(--p-inv-bg);
  color: var(--p-inv-ink);
  --bg: var(--p-inv-bg);
  --surface: var(--p-inv-surface);
  --ink: var(--p-inv-ink);
  --muted: var(--p-inv-muted);
  --accent: var(--p-inv-accent);
  --accent-ink: var(--p-inv-accent-ink);
  --action: var(--p-inv-action);
  --action-ink: var(--p-inv-action-ink);
  --line: rgba(243, 241, 236, 0.16);
}

.develop {
  margin: 0;
  border-radius: var(--r-lg);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: var(--surface);
}

.develop > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mill-thumbs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-4);
  margin-top: var(--s-4);
}

.mill-thumbs__item {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: var(--r-md);
  background: var(--surface);
}

.mill-thumbs__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.rows .rows__name small {
  display: block;
  font-weight: 400;
  color: var(--muted);
  font-size: var(--t-small);
  margin-top: 2px;
}

.cert-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--gutter);
  margin-top: var(--s-6);
  padding-top: var(--s-5);
  border-top: 1px solid var(--line);
}

.cert-item strong {
  display: block;
  font-size: var(--t-card);
  font-weight: 500;
  color: var(--ink);
}

.cert-item span {
  display: block;
  font-size: var(--t-small);
  color: var(--muted);
  margin-top: 2px;
}

/* Structured spec table (SEO & GEO) */
.spec-table-wrap {
  width: 100%;
  overflow-x: auto;
  border-top: 1px solid var(--line);
}

.spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--t-small);
  text-align: left;
}

.spec-table th,
.spec-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.spec-table th {
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.spec-table td {
  color: var(--muted);
}

.spec-table td:first-child {
  color: var(--ink);
  font-weight: 500;
}

/* Products catalogue page */
.crumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: var(--t-small);
  color: var(--muted);
  margin-bottom: var(--s-4);
}

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

.crumb a:hover {
  color: var(--ink);
  text-decoration: underline;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.filter-chip {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: var(--t-small);
  font-weight: 500;
  cursor: pointer;
}

.filter-chip[aria-pressed="true"] {
  background: var(--action);
  color: var(--action-ink);
  border-color: var(--action);
}

.filter-row--sub {
  margin-top: var(--s-3);
}

.filter-row--sub .filter-chip {
  min-height: 36px;
  padding: 0 14px;
  font-size: 13px;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gutter);
  margin-top: var(--s-6);
}

.product-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding-bottom: var(--s-5);
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}

.product-card[hidden] {
  display: none;
}

.product-card__img {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--r-md);
  background: var(--surface);
}

.product-card__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-card__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

.product-card h3 {
  margin: 0;
  font-size: var(--t-h3);
}

.product-card__summary {
  margin: 0;
  font-size: var(--t-small);
  color: var(--muted);
}

/* Product Detail Page (Main photo + specs top, vertical detail gallery below) */
.detail-top {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: start;
}

.detail-main-img {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--surface);
}

.detail-main-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.detail-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: var(--s-3);
}

.detail-swatches {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: var(--s-4);
}

.detail-swatches[hidden] {
  display: none;
}

.detail-swatch {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(29, 37, 48, 0.22);
  cursor: pointer;
  position: relative;
  background: var(--swatch, #ffffff);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.detail-swatch:hover {
  transform: scale(1.1);
}

.detail-swatch[aria-pressed="true"] {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--ink);
}

.detail-thumb {
  width: 72px;
  height: 54px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--surface);
  cursor: pointer;
}

.detail-thumb[aria-current="true"] {
  border-color: var(--accent);
}

.detail-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.detail-info h1 {
  margin: var(--s-2) 0 var(--s-3);
}

.detail-specs {
  width: 100%;
  border-collapse: collapse;
  margin: var(--s-5) 0;
  font-size: var(--t-small);
  border-top: 1px solid var(--line);
}

.detail-specs th,
.detail-specs td {
  padding: 12px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.detail-specs th {
  width: 38%;
  color: var(--muted);
  font-weight: 500;
}

.detail-specs td {
  color: var(--ink);
  font-weight: 500;
}

.detail-gallery {
  max-width: 820px;
  margin: var(--s-6) auto 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-gallery img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--r-md);
  background: var(--surface);
}

/* Contact & inquiry */
.contact-dl {
  margin: var(--s-5) 0 0;
  display: grid;
  gap: var(--s-4);
}

.contact-dl div {
  padding-top: var(--s-3);
  border-top: 1px solid var(--line);
}

.contact-dl dt {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 4px;
}

.contact-dl dd {
  margin: 0;
  font-size: var(--t-body);
  color: var(--ink);
}

.contact-dl a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-top: 6px;
}

.check-row label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-weight: 400;
  cursor: pointer;
}

.check-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

@media (max-width: 1023px) {
  .cat-trio,
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .hero-metrics,
  .cert-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .detail-top {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 639px) {
  .hero--product .hero__stage {
    aspect-ratio: 4 / 3;
  }
  .cat-trio,
  .product-grid,
  .mill-thumbs {
    grid-template-columns: 1fr;
  }
}
