@import url("../../fonts/fonts.css");

/* =========================================================================
   Xinhai Mining Equipment - site.css
   Tokens are the single source of truth and mirror DESIGN.md section 2.
   New colours or fonts go into DESIGN.md first, then here.
   Single locked light theme (DESIGN.md section 2 rule 11).
   ========================================================================= */

:root {
  --paper: #f4f6f7;
  --surface: #ffffff;
  --surface-2: #e9edef;
  --line: #d3dadd;
  --line-strong: #a9b4b9;
  --ink: #10171a;
  --ink-muted: #5a676d;
  --accent: #c4400b;
  --accent-hover: #a53508;
  --accent-ink: #ffffff;
  --accent-wash: #fceee8;
  --ink-block: #151d21;
  --ink-block-tx: #e6ebed;
  --danger: #c0362f;
  --ok: #2e7d57;

  --font-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Barlow", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Roboto Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --radius: 3px;
  --container: 1280px;
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: 1.25rem;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --fast: 150ms;
  --reveal: 320ms;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Single locked light theme, declared so form controls and scrollbars
     render light even when the OS is in dark mode. */
  color-scheme: light;
}
/* Kill the 300ms tap delay and the default blue flash on touch. */
a, button, select, input, textarea, summary, label { touch-action: manipulation; }
a, button { -webkit-tap-highlight-color: rgba(196, 64, 11, 0.12); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
h1, h2, h3, h4 {
  font-family: var(--font-display); font-weight: 700; line-height: 1.15; margin: 0;
  text-wrap: balance;   /* stops a one-word orphan on the last line */
}
/* Capped at 2.85rem so a 7-word headline still lands in two lines in the hero
   column. A three-line hero headline is a font-scale error, not a copy problem. */
h1 { font-size: clamp(2rem, 3.6vw, 2.85rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.6rem, 2.8vw, 2.3rem); letter-spacing: -0.02em; }
h3 { font-size: 1.2rem; font-weight: 600; }
p { margin: 0 0 1rem; max-width: 68ch; }
ul, ol { margin: 0 0 1rem; padding-left: 1.15rem; }
li { margin-bottom: 0.35rem; }

/* keyboard focus is never removed */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- layout ---------- */
.wrap { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: 1.25rem; }
.section { padding-block: var(--section-y); }
.section--tight { padding-block: clamp(2.25rem, 4.5vw, 3.5rem); }
.section--wash { background: var(--surface-2); }
.section--ink { background: var(--ink-block); color: var(--ink-block-tx); }
.section--ink h2, .section--ink h3 { color: #fff; }
.lede { font-size: 1.1875rem; color: var(--ink-muted); max-width: 62ch; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: var(--accent-ink);
  padding: 0.6rem 1rem; z-index: 100; font-weight: 600;
}
.skip-link:focus { left: 0; }

/* ---------- header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(244, 246, 247, 0.94);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem; height: 68px;
}
.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; flex-shrink: 0; }
.brand__mark { width: 26px; height: 26px; flex: none; }
.brand__name {
  font-family: var(--font-display); font-weight: 700; font-size: 1.0625rem;
  letter-spacing: -0.01em; white-space: nowrap;
}
.brand__name span { color: var(--accent); }

.nav__list {
  display: flex; align-items: center; gap: 1.4rem;
  list-style: none; margin: 0; padding: 0;
}
.nav__list a {
  text-decoration: none; font-weight: 500; font-size: 0.9375rem;
  padding-block: 0.4rem; border-bottom: 2px solid transparent;
  transition: color var(--fast) var(--ease), border-color var(--fast) var(--ease);
  white-space: nowrap;
}
.nav__list a[aria-current="page"] { border-bottom-color: var(--accent); color: var(--accent); }
.nav__toggle { display: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.5rem; white-space: nowrap;
  font-family: var(--font-body); font-weight: 600; font-size: 0.9375rem;
  padding: 0.75rem 1.35rem; border-radius: var(--radius);
  border: 1px solid transparent; text-decoration: none; cursor: pointer;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease),
              transform var(--fast) var(--ease);
}
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.section--ink .btn--ghost { color: var(--ink-block-tx); border-color: #3c474c; }
.btn:active { transform: scale(0.975); }

/* ---------- hero ---------- */
.hero { padding-top: clamp(2.5rem, 5vw, 4rem); padding-bottom: var(--section-y); }
.hero__grid {
  display: grid; gap: clamp(1.5rem, 4vw, 3rem);
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.95fr);
  align-items: center;
}
.hero__title { margin-bottom: 1rem; }
/* 52ch keeps a ~40 word technical lede inside the 4-line hero budget. */
.hero__sub { font-size: 1.125rem; color: var(--ink-muted); max-width: 52ch; margin-bottom: 1.75rem; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.hero__media { position: relative; margin: 0; }
.hero__media img { border-radius: var(--radius); border: 1px solid var(--line); width: 100%; }

/* Supplier catalogue renders are square and carry the maker's own watermark.
   Present them as catalogue plates on a white ground rather than stretching a
   750px square into a wide photographic hero. */
.hero__media--render {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.25rem 0.75rem;
}
.hero__media--render img {
  border: 0; border-radius: 0;
  aspect-ratio: 1 / 1; object-fit: contain;
  max-width: 420px; margin-inline: auto;
}
.hero__media--render figcaption {
  font-family: var(--font-mono); font-size: 0.75rem; color: var(--ink-muted);
  text-align: center; padding-top: 0.75rem; margin-top: 0.5rem;
  border-top: 1px solid var(--line);
}

/* data-led header for categories with no real photograph */
.hero--data .hero__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr); }
.spec-stack { border-top: 2px solid var(--line-strong); }
.spec-stack__row {
  display: flex; gap: 1rem; align-items: baseline;
  padding: 0.6rem 0; border-bottom: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 0.8125rem; color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}
.spec-stack__row b {
  font-family: var(--font-mono); font-weight: 500; color: var(--accent);
  min-width: 2.25rem; flex: none;
}

/* ---------- breadcrumb ---------- */
.crumb { font-size: 0.875rem; color: var(--ink-muted); padding-block: 1rem 0; }
.crumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 0; padding: 0; }
.crumb li::after { content: "/"; margin-left: 0.45rem; color: var(--line-strong); }
.crumb li:last-child::after { content: ""; }
.crumb a { text-decoration: none; }

/* ---------- eyebrow (rationed: max 1 per 3 sections, see DESIGN.md) ---------- */
.eyebrow {
  font-family: var(--font-mono); font-size: 0.75rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--accent);
  margin-bottom: 0.75rem;
}

/* ---------- stage grid (equipment index, deliberately non-equal columns) ---------- */
.stage { margin-bottom: 2.75rem; }
.stage__head {
  display: flex; align-items: baseline; gap: 0.9rem;
  border-bottom: 2px solid var(--line-strong); padding-bottom: 0.6rem; margin-bottom: 1.25rem;
}
.stage__n { font-family: var(--font-mono); font-size: 0.8125rem; color: var(--accent); }
.cat-grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); }
.cat {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; overflow: hidden;
  transition: border-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
/* Same reason as .hero__media--render: square catalogue plates, contained not cropped. */
.cat img {
  aspect-ratio: 4 / 3; object-fit: contain; width: 100%;
  background: var(--surface); padding: 0.75rem;
  border-bottom: 1px solid var(--line);
}
.cat__body { padding: 0.9rem 1rem 1.1rem; display: flex; flex-direction: column; gap: 0.3rem; flex: 1; }
.cat__title { font-family: var(--font-display); font-weight: 600; font-size: 1.0625rem; }
.cat__meta { font-family: var(--font-mono); font-size: 0.75rem; color: var(--ink-muted); }
.cat--nophoto .cat__body { padding-top: 1.25rem; border-top: 3px solid var(--accent); }

/* ---------- data table (no per-row rules, zebra only) ---------- */
.data { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.data caption { text-align: left; color: var(--ink-muted); font-size: 0.875rem; padding-bottom: 0.6rem; }
.data th {
  text-align: left; font-family: var(--font-mono); font-size: 0.75rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-muted);
  border-bottom: 2px solid var(--line-strong); padding: 0.55rem 0.75rem;
}
.data td { padding: 0.6rem 0.75rem; vertical-align: top; }
.data tbody tr:nth-child(even) { background: var(--surface-2); }
.data .num { font-family: var(--font-mono); font-size: 0.8125rem; white-space: nowrap;
  font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; }

/* ---------- equipment list (2-col grouped, not a bullet dump) ---------- */
.eq-list {
  columns: 2; column-gap: 2.5rem; list-style: none; padding: 0; margin: 0;
  font-size: 0.9375rem;
}
.eq-list li { break-inside: avoid; padding: 0.4rem 0; border-bottom: 1px solid var(--line); }
.eq-list .tag {
  font-family: var(--font-mono); font-size: 0.6875rem; color: var(--ink-muted);
  margin-left: 0.4rem;
}

/* ---------- selection variables ---------- */
.vars { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); list-style: none; padding: 0; margin: 0; }
.vars li {
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: var(--radius); padding: 0.75rem 0.9rem; font-size: 0.9375rem; margin: 0;
}

/* ---------- caveat block (knowledge-base warnings, mandatory) ---------- */
.caveat {
  background: var(--accent-wash); border: 1px solid #f0cdbd; border-radius: var(--radius);
  padding: 1rem 1.15rem; font-size: 0.9375rem; color: #6b3213;
}
.caveat b { font-family: var(--font-display); display: block; margin-bottom: 0.25rem; }
.caveat p { margin: 0; max-width: none; }

/* ---------- claims strip ---------- */
.claims { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.claim__n { font-family: var(--font-mono); font-size: 1.75rem; font-weight: 500; color: var(--accent);
  font-variant-numeric: tabular-nums; }
.claim__l { font-size: 0.875rem; color: var(--ink-muted); }
.section--ink .claim__l { color: #9aa7ac; }

/* ---------- form ---------- */
.form { display: grid; gap: 1rem; max-width: 640px; }
.field { display: grid; gap: 0.4rem; }
.field label { font-weight: 600; font-size: 0.9375rem; }
.field .hint { font-size: 0.8125rem; color: var(--ink-muted); }
.field input, .field select, .field textarea {
  font-family: var(--font-body); font-size: 1rem; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 0.7rem 0.8rem; width: 100%;
}
.field input::placeholder, .field textarea::placeholder { color: #7c878c; }
.field textarea { min-height: 130px; resize: vertical; }
.field .err { font-size: 0.8125rem; color: var(--danger); font-weight: 600; }
.field [aria-invalid="true"] { border-color: var(--danger); }
.form__status { font-size: 0.9375rem; }
.form__status[data-state="ok"] { color: var(--ok); font-weight: 600; }
.form__status[data-state="err"] { color: var(--danger); }
.honey { position: absolute; left: -9999px; }

/* ---------- footer ---------- */
.site-footer { background: var(--ink-block); color: var(--ink-block-tx); padding-block: 3rem 2rem; }
.site-footer a { color: var(--ink-block-tx); text-decoration: none; }
.foot-grid { display: grid; gap: 2rem; grid-template-columns: 1.4fr 1fr 1fr; }
.foot-grid h3 { font-size: 0.8125rem; font-family: var(--font-mono); font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.1em; color: #8b989d; margin-bottom: 0.9rem; }
.foot-list { list-style: none; padding: 0; margin: 0; font-size: 0.9375rem; }
.foot-list li { margin-bottom: 0.45rem; }
.foot-bottom {
  margin-top: 2.5rem; padding-top: 1.25rem; border-top: 1px solid #2a3438;
  font-size: 0.8125rem; color: #8b989d;
}

/* ---------- prev / next process nav ---------- */
.pagenav { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.pagenav a { text-decoration: none; font-weight: 600; font-size: 0.9375rem; }
.pagenav small { display: block; font-family: var(--font-mono); font-size: 0.75rem;
  color: var(--ink-muted); font-weight: 400; }

/* =========================================================================
   Motion. MOTION_INTENSITY 3: reveal on entry, press feedback, current state.
   Nothing else. Every effect below is gated and degrades to static.
   ========================================================================= */
.js .reveal { opacity: 0; transform: translateY(14px); }
.js .reveal.is-in {
  opacity: 1; transform: none;
  transition: opacity var(--reveal) var(--ease), transform var(--reveal) var(--ease);
}
/* Only place where many items enter together. 45ms apart, capped at 8 so a
   19-item grid never takes longer than the first screenful to settle. */
.js .cat-grid.reveal.is-in > .cat,
.js .reveal.is-in > .cat-grid > .cat { transition-delay: 0ms; }
.js .stage.reveal .cat:nth-child(1) { transition-delay: 0ms; }
.js .stage.reveal .cat:nth-child(2) { transition-delay: 45ms; }
.js .stage.reveal .cat:nth-child(3) { transition-delay: 90ms; }
.js .stage.reveal .cat:nth-child(4) { transition-delay: 135ms; }
.js .stage.reveal .cat:nth-child(n+5) { transition-delay: 180ms; }

/* hover gated so touch devices never latch a hover state */
@media (hover: hover) and (pointer: fine) {
  .nav__list a:hover { color: var(--accent); border-bottom-color: var(--line-strong); }
  .btn--primary:hover { background: var(--accent-hover); }
  .btn--ghost:hover { border-color: var(--ink); }
  .cat:hover { border-color: var(--accent); transform: translateY(-2px); }
  .crumb a:hover, .foot-list a:hover { color: var(--accent); text-decoration: underline; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  /* Reduced motion means less movement, not no feedback. Colour and opacity
     transitions still help comprehension, so they stay; only travel is removed. */
  .js .reveal, .js .reveal.is-in { opacity: 1; transform: none; transition: none; }
  .js .stage.reveal .cat { transition-delay: 0ms; }
  .btn:active { transform: none; background-color: var(--accent-hover); }
  .cat:hover { transform: none; }
  *, *::before, *::after { animation-duration: 0.01ms !important; }
}

/* =========================================================================
   Responsive. Every multi-column block declares its collapse explicitly.
   ========================================================================= */
@media (max-width: 1023px) {
  .foot-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 860px) {
  /* hamburger is mobile only. Desktop always shows the full nav (SOP pitfall 9). */
  .nav__toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; background: none; border: 1px solid var(--line-strong);
    border-radius: var(--radius); cursor: pointer; padding: 0;
  }
  .nav__toggle svg { width: 20px; height: 20px; }
  .nav__list {
    position: absolute; inset-inline: 0; top: 68px;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--surface); border-bottom: 1px solid var(--line);
    padding: 0.5rem 1.25rem 1rem;
  }
  .nav__list[hidden] { display: none; }
  .nav__list a { padding-block: 0.85rem; border-bottom: 1px solid var(--line); }
  .nav__list a[aria-current="page"] { border-bottom-color: var(--accent); }

  .hero__grid, .hero--data .hero__grid { grid-template-columns: 1fr; }
  .hero__media { order: -1; }
  .eq-list { columns: 1; }
  .foot-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  body { font-size: 1rem; }
  .cat-grid { grid-template-columns: 1fr 1fr; }
  .cat__body { padding: 0.7rem 0.75rem 0.9rem; }
  .cat__title { font-size: 0.9375rem; }
  .claims { grid-template-columns: 1fr 1fr; }
}

@media print {
  .site-header, .site-footer, .hero__cta, .pagenav { display: none; }
  body { background: #fff; }
}

/* ---------- trust strip (CRO: credibility on every landing page) ---------- */
.trust { background: var(--surface); border-block: 1px solid var(--line); }
.trust__certs {
  margin: 1.5rem 0 0; max-width: none;
  font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.02em;
  color: var(--ink-muted);
}
@media (max-width: 560px) {
  .trust__certs { font-size: 0.6875rem; }
}

/* ---------- spec tables (from the equipment application manual) ---------- */
#parameters h3 {
  margin: 2.5rem 0 0.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  scroll-margin-top: 90px;          /* sticky nav clearance for anchor links */
}
#parameters h3:first-of-type { border-top: 0; padding-top: 0; margin-top: 2rem; }
.data.spec { min-width: 640px; }     /* forces the scroll container instead of squashing */
.data.spec th { white-space: nowrap; }
.data.spec td { white-space: nowrap; }
.data.spec td:first-child { font-family: var(--font-mono); font-size: 0.8125rem; font-weight: 500; }
.table-scroll {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface);
}
.table-scroll table { margin: 0; }
.table-scroll caption {
  padding: 0.7rem 0.75rem 0.5rem;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 0.75rem;
}
