/* ============================================================
   TIANHE MACHINERY — Design System
   Industrial B2B machinery website · 4 languages (en/es/ru/fr)
   Mobile-first: base = small screens, desktop in min-width queries
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  --navy-900: #0A2447;
  --navy-800: #0E2E5C;
  --blue-700: #17468F;   /* primary brand */
  --blue-600: #1E57AC;
  --blue-500: #2F6EC5;   /* hover */
  --blue-100: #E4EDF9;   /* tint */
  --blue-50:  #F3F7FC;
  --ink:      #1E2733;
  --ink-soft: #556170;
  --ink-faint:#8792A1;
  --line:     #DEE5EE;
  --bg-soft:  #F4F7FA;
  --white:    #FFFFFF;
  --focus:    #E8A33D;   /* amber, focus rings only */
  --radius:   6px;
  --shadow:   0 1px 2px rgba(10,36,71,.08), 0 8px 24px -12px rgba(10,36,71,.18);
  --font-sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
}

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html, body { overflow-x: hidden; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--white);
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--blue-600); text-decoration: none; }
a:hover { color: var(--blue-700); text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.22; font-weight: 700; color: var(--navy-900); letter-spacing: -.01em; }
h1 { font-size: clamp(1.7rem, 5.4vw, 2.6rem); }
h2 { font-size: clamp(1.35rem, 4vw, 1.9rem); }
h3 { font-size: 1.12rem; }
p { margin: 0 0 1em; }
ul { margin: 0 0 1em; padding-left: 1.2em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
::selection { background: var(--blue-100); }

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

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 18px; }

/* ---------- Buttons & CTA ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45em;
  min-height: 46px; padding: .65em 1.35em;
  border-radius: var(--radius); border: 1px solid transparent;
  font-family: inherit; font-size: 1rem; font-weight: 600; line-height: 1.2;
  cursor: pointer; text-decoration: none; transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.btn-primary { background: var(--blue-700); color: #fff; }
.btn-primary:hover { background: var(--blue-600); color: #fff; text-decoration: none; }
.btn-outline { background: transparent; color: var(--blue-700); border-color: var(--blue-700); }
.btn-outline:hover { background: var(--blue-100); text-decoration: none; }
.btn-light { background: #fff; color: var(--navy-900); }
.btn-light:hover { background: var(--blue-50); text-decoration: none; }
.btn-block { width: 100%; }

/* ---------- Topbar ---------- */
.topbar { background: var(--navy-900); color: #C9D6EA; font-size: .82rem; }
.topbar .container { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; }
.topbar-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Language switcher (topbar) */
.lang-switch { position: relative; }
.lang-switch select {
  appearance: none; -webkit-appearance: none;
  min-height: 40px; padding: 0 30px 0 12px;
  background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.28); border-radius: var(--radius);
  font-family: inherit; font-size: .84rem; cursor: pointer;
}
.lang-switch::after {
  content: ""; position: absolute; right: 12px; top: 50%; width: 8px; height: 8px;
  border-right: 2px solid #fff; border-bottom: 2px solid #fff;
  transform: translateY(-70%) rotate(45deg); pointer-events: none;
}
.lang-switch select option { color: var(--ink); background: #fff; }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: #fff; border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px; }
.brand { display: flex; align-items: center; gap: 12px; min-height: 46px; }
.brand-mark { flex: 0 0 auto; }
.brand-name { display: flex; flex-direction: column; line-height: 1.12; }
.brand-name strong { font-size: 1.06rem; font-weight: 700; color: var(--navy-900); letter-spacing: .04em; }
.brand-name span { font-size: .72rem; color: var(--ink-soft); letter-spacing: .02em; }

.main-nav { display: none; }
.main-nav ul { list-style: none; display: flex; align-items: center; gap: 4px; margin: 0; padding: 0; }
.main-nav a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px;
  color: var(--ink); font-weight: 600; font-size: .97rem; border-radius: var(--radius);
}
.main-nav a:hover { color: var(--blue-700); background: var(--blue-50); text-decoration: none; }
.main-nav a[aria-current="page"] { color: var(--blue-700); background: var(--blue-100); }
.header-actions { display: flex; align-items: center; gap: 10px; }
.header-cta { display: none; }

/* Mobile nav toggle */
.nav-toggle {
  display: inline-flex; flex-direction: column; justify-content: center; gap: 5px;
  width: 46px; height: 46px; padding: 10px;
  background: none; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer;
}
.nav-toggle span { display: block; height: 2px; width: 100%; background: var(--navy-900); transition: transform .2s ease, opacity .2s ease; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-nav { display: none; background: #fff; border-top: 1px solid var(--line); }
.mobile-nav.open { display: block; }
.mobile-nav ul { list-style: none; margin: 0; padding: 8px 18px 16px; }
.mobile-nav a {
  display: flex; align-items: center; min-height: 48px; padding: 0 6px;
  font-weight: 600; color: var(--ink); border-bottom: 1px solid var(--line);
}
.mobile-nav a:last-child { border-bottom: none; }
.mobile-nav a[aria-current="page"] { color: var(--blue-700); }

/* ---------- Hero ---------- */
.hero { position: relative; background: var(--navy-900); color: #fff; }
.hero-media { position: absolute; inset: 0; }
.hero-media img { width: 100%; height: 100%; object-fit: cover; object-position: center; }
.hero-media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(105deg, rgba(10,36,71,.92) 0%, rgba(10,36,71,.72) 48%, rgba(10,36,71,.35) 100%); }
.hero-body { position: relative; z-index: 1; padding: 64px 0 72px; max-width: 720px; }
.hero-kicker { display: inline-block; margin-bottom: 14px; font-size: .82rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: #BFD3F2; }
.hero h1 { color: #fff; margin-bottom: .45em; }
.hero p.lead { font-size: 1.06rem; color: #D7E2F3; max-width: 58ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }

/* ---------- Stats strip ---------- */
.stats { background: var(--navy-800); color: #fff; }
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); }
.stat { padding: 22px 18px; border-left: 1px solid rgba(255,255,255,.14); text-align: center; }
.stat:first-child { border-left: none; }
.stat b { display: block; font-size: 1.7rem; font-weight: 700; color: #fff; line-height: 1.1; }
.stat span { font-size: .85rem; color: #B9C9E2; }

/* ---------- Sections ---------- */
.section { padding: 52px 0; }
.section-soft { background: var(--bg-soft); }
.section-head { max-width: 760px; margin-bottom: 34px; }
.section-head.center { margin-left: auto; margin-right: auto; text-align: center; }
.section-kicker { display: inline-block; margin-bottom: 8px; font-size: .8rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--blue-600); }
.section-head p { color: var(--ink-soft); margin: 0; }

/* ---------- Product cards ---------- */
.card-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.all-products-grid { display: grid; grid-template-columns: repeat(1, 1fr); gap: 18px; margin-top: 26px; }
.all-products-grid .series-head { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 10px; margin: 10px 0 0; scroll-margin-top: 90px; }
.all-products-grid .series-num { font-family: var(--font-mono); font-size: .85rem; color: var(--blue-600); }
.all-products-grid .card { min-width: 0; }
.card {
  display: flex; flex-direction: column;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
  transition: transform .15s ease, border-color .15s ease;
}
.card:hover { transform: translateY(-3px); border-color: #BCCBE2; }
.card-media { position: relative; aspect-ratio: 4 / 3; background: #fff; }
.card-media img { width: 100%; height: 100%; object-fit: contain; padding: 10px; }
.card-body { display: flex; flex-direction: column; flex: 1; padding: 14px 16px 16px; }
.card-body h3 { margin-bottom: .3em; font-size: 1rem; }
.card-body .models { font-family: var(--font-mono); font-size: .84rem; color: var(--blue-700); font-weight: 500; }
.card-body p { font-size: .9rem; color: var(--ink-soft); margin-bottom: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-link { margin-top: auto; font-weight: 600; font-size: .92rem; color: var(--blue-700); display: inline-flex; align-items: center; gap: 4px; min-height: 44px; }
.card-link:hover { text-decoration: none; color: var(--blue-600); }

/* Series block on products page */
.series-block { margin-bottom: 46px; scroll-margin-top: 96px; }
.series-block > h2 { display: flex; align-items: baseline; gap: 12px; padding-bottom: 10px; border-bottom: 2px solid var(--blue-700); }
.series-num { font-family: var(--font-mono); font-size: .95rem; color: var(--blue-500); }

/* ---------- Flow steps (tablet production process) ---------- */
.flow { counter-reset: step; display: grid; grid-template-columns: 1fr; gap: 12px; }
.flow-item {
  position: relative; background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 16px 16px 58px; min-height: 72px; display: flex; align-items: center;
}
.flow-item::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--blue-700); color: #fff;
  font-family: var(--font-mono); font-weight: 600; font-size: .95rem;
  display: flex; align-items: center; justify-content: center;
}
.flow-item b { font-weight: 600; color: var(--navy-900); }

/* ---------- Why / value cards ---------- */
.value-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.value-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.value-card svg { color: var(--blue-700); margin-bottom: 10px; }
.value-card h3 { font-size: 1.05rem; }
.value-card p { font-size: .93rem; color: var(--ink-soft); margin: 0; }

/* ---------- CTA band ---------- */
.cta-band { background: var(--navy-800); color: #fff; }
.cta-band .container { display: flex; flex-direction: column; gap: 18px; align-items: flex-start; padding-top: 46px; padding-bottom: 46px; }
.cta-band h2 { color: #fff; margin: 0; }
.cta-band p { color: #C4D3E8; margin: 0; max-width: 60ch; }

/* ---------- Breadcrumbs ---------- */
.breadcrumbs { font-size: .86rem; color: var(--ink-faint); padding: 16px 0 0; }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.breadcrumbs li + li::before { content: "/"; margin-right: 6px; color: var(--line); }
.breadcrumbs a { color: var(--ink-soft); }
.breadcrumbs [aria-current="page"] { color: var(--ink); }

/* ---------- Product detail ---------- */
.product-detail { display: grid; grid-template-columns: 1fr; gap: 28px; padding-top: 24px; }
.product-gallery { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.product-gallery img { width: 100%; max-height: 480px; object-fit: contain; }
.product-info h1 { margin-bottom: .3em; }
.product-info .models-tag { font-family: var(--font-mono); color: var(--blue-700); font-weight: 600; font-size: .95rem; }
.product-info .profile { color: var(--ink); }
.spec-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table.spec { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.spec th, table.spec td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.spec thead th { background: var(--navy-900); color: #fff; font-weight: 600; font-size: .88rem; }
table.spec tbody th { font-weight: 600; color: var(--navy-900); background: var(--blue-50); width: 34%; }
table.spec td { font-family: var(--font-mono); font-size: .88rem; }
table.spec tr:last-child th, table.spec tr:last-child td { border-bottom: none; }
table.spec tbody tr:nth-child(even) td { background: #FAFCFF; }

.feature-list { list-style: none; padding: 0; margin: 0 0 20px; }
.feature-list li { position: relative; padding: 6px 0 6px 26px; color: var(--ink); }
.feature-list li::before { content: ""; position: absolute; left: 4px; top: 16px; width: 8px; height: 8px; background: var(--blue-600); border-radius: 2px; }

.related-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.pager { display: flex; justify-content: space-between; gap: 10px; margin-top: 30px; }
.pager a { font-weight: 600; font-size: .92rem; }

/* ---------- Facts / About ---------- */
.facts-table { width: 100%; border-collapse: collapse; }
.facts-table th, .facts-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.facts-table th { width: 40%; font-weight: 600; color: var(--navy-900); background: var(--blue-50); }
.facts-table tr:last-child th, .facts-table tr:last-child td { border-bottom: none; }
.about-layout { display: grid; grid-template-columns: 1fr; gap: 28px; }
.about-photo img { width: 100%; border-radius: var(--radius); border: 1px solid var(--line); }
.workshop-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.workshop-grid figure { margin: 0; }
.workshop-grid img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); }
.workshop-grid figcaption { font-size: .8rem; color: var(--ink-faint); padding-top: 6px; }

/* Timeline */
.timeline { margin: 0; padding: 0; list-style: none; }
.timeline li { position: relative; padding: 0 0 26px 30px; border-left: 2px solid var(--blue-100); margin-left: 8px; }
.timeline li:last-child { padding-bottom: 0; border-left-color: transparent; }
.timeline li::before {
  content: ""; position: absolute; left: -8px; top: 4px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--blue-700); border: 3px solid #fff; box-shadow: 0 0 0 2px var(--blue-700);
}
.timeline .tl-year { font-family: var(--font-mono); font-weight: 700; color: var(--blue-700); }
.timeline .tl-event { font-weight: 700; color: var(--navy-900); }
.timeline p { color: var(--ink-soft); font-size: .93rem; margin: 4px 0 0; }

/* ---------- Contact ---------- */
.contact-layout { display: grid; grid-template-columns: 1fr; gap: 28px; }
.contact-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; color: var(--navy-900); }
.field input, .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 11px 13px;
  font-family: inherit; font-size: 1rem; color: var(--ink);
  border: 1px solid #C6D0DE; border-radius: var(--radius); background: #fff;
}
.field textarea { min-height: 130px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 3px solid var(--focus); outline-offset: 0; border-color: var(--blue-500); }
.field .hint { font-size: .82rem; color: var(--ink-faint); margin-top: 5px; }
.form-msg { display: none; margin-top: 12px; padding: 12px 14px; border-radius: var(--radius); font-size: .92rem; }
.form-msg.ok { display: block; background: #E7F4EC; border: 1px solid #BFE3CC; color: #1F6B3C; }
.form-msg.err { display: block; background: #FBEAEA; border: 1px solid #F0C9C9; color: #8A2A2A; }

/* ---------- Footer ---------- */
.site-footer { background: var(--navy-900); color: #C4D3E8; font-size: .92rem; }
.footer-grid { display: grid; grid-template-columns: 1fr; gap: 28px; padding: 46px 0 30px; }
.site-footer h4 { color: #fff; font-size: .95rem; margin-bottom: 14px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 8px; }
.site-footer a { color: #C4D3E8; display: inline-flex; align-items: center; min-height: 40px; }
.site-footer a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.14); padding: 18px 0; font-size: .84rem; color: #93A6C2; display: flex; flex-direction: column; gap: 8px; }
.footer-langs { display: flex; flex-wrap: wrap; gap: 4px 18px; }

/* ---------- 404 ---------- */
.notfound { text-align: center; padding: 90px 0 110px; }
.notfound .nf-code { font-family: var(--font-mono); font-size: 4.5rem; font-weight: 700; color: var(--blue-100); line-height: 1; }

/* ---------- Responsive: ≥ 640px ---------- */
@media (min-width: 640px) {
  .card-grid { grid-template-columns: repeat(3, 1fr); }
  .all-products-grid { grid-template-columns: repeat(2, 1fr); }
  .value-grid { grid-template-columns: repeat(2, 1fr); }
  .flow { grid-template-columns: repeat(2, 1fr); }
  .workshop-grid { grid-template-columns: repeat(3, 1fr); }
  .related-grid { grid-template-columns: repeat(3, 1fr); }
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .cta-band .container { flex-direction: row; align-items: center; justify-content: space-between; }
  .cta-band .container > div { flex: 1; }
}

/* ---------- Mobile: stacked multi-model spec tables ---------- */
@media (max-width: 639px) {
  table.spec--multi thead { display: none; }
  table.spec--multi, table.spec--multi tbody, table.spec--multi tr, table.spec--multi th, table.spec--multi td { display: block; width: 100%; }
  table.spec--multi tr { border-bottom: 1px solid var(--line); padding: 10px 14px; }
  table.spec--multi tr:last-child { border-bottom: none; }
  table.spec--multi tbody th { width: auto; background: none; padding: 0 0 4px; color: var(--ink-soft); }
  table.spec--multi td { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 4px 0 0; border: none; background: none !important; font-size: .88rem; }
  table.spec--multi td::before { content: attr(data-m); font-family: var(--font-sans); font-weight: 600; color: var(--blue-700); white-space: nowrap; }
}

/* ---------- Responsive: ≥ 900px ---------- */
@media (min-width: 900px) {
  .main-nav { display: block; }
  .nav-toggle { display: none; }
  .mobile-nav { display: none !important; }
  .header-cta { display: inline-flex; }
  .hero-body { padding: 110px 0 130px; }
  .hero p.lead { font-size: 1.15rem; }
  .section { padding: 72px 0; }
  .all-products-grid { grid-template-columns: repeat(3, 1fr); }
  .product-detail { grid-template-columns: minmax(0, 44%) 1fr; gap: 40px; }
  .product-gallery { position: sticky; top: 100px; align-self: start; }
  .about-layout { grid-template-columns: minmax(0, 55%) 1fr; }
  .contact-layout { grid-template-columns: minmax(0, 58%) 1fr; }
  .flow { grid-template-columns: repeat(3, 1fr); }
  .footer-grid { grid-template-columns: 1.4fr 1fr 1fr 1fr; }
  .footer-bottom { flex-direction: row; align-items: center; justify-content: space-between; }
}

/* ---------- Responsive: ≥ 1200px ---------- */
@media (min-width: 1200px) {
  .card-grid { grid-template-columns: repeat(4, 1fr); }
  .all-products-grid { grid-template-columns: repeat(4, 1fr); }
  .value-grid { grid-template-columns: repeat(4, 1fr); }
  .workshop-grid { grid-template-columns: repeat(4, 1fr); }
  .related-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- SEO keyword link lines ---------- */
.series-kw-line { margin: 10px 0 0; font-size: 0.95rem; }
.series-kw-line a, .related-more a { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.related-more { margin: 6px 0 18px; font-size: 0.95rem; }
