@import "brand-tokens.css";

/* HaoShengFa Trade Limited — core system
   Framed, ruled, harbour-teal. Spectral + IBM Plex Sans. */

:root {
  --u: 8px;
  --maxw: 1320px;
  --gutter: clamp(20px, 5vw, 64px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
  --dur: 0.7s;
  --shadow-1: 0 1px 2px rgba(15,26,30,.05), 0 8px 24px rgba(15,26,30,.06);
  --shadow-2: 0 24px 60px -20px rgba(15,26,30,.28);
  --frame: 1px solid var(--line);
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  overflow-x: hidden;
}
body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  font-size: clamp(16px, 1.05vw, 17px);
  line-height: 1.7;
  font-weight: 400;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { font: inherit; cursor: pointer; background: none; border: none; color: inherit; }
::selection { background: var(--accent); color: var(--white); }

html.has-smooth { scroll-behavior: auto; }

.skip {
  position: absolute; left: var(--gutter); top: -48px; z-index: 400;
  background: var(--ink); color: #fff; padding: 10px 16px;
  font-size: 0.85rem;
}
.skip:focus { top: 12px; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.display {
  font-size: clamp(2.15rem, 6.4vw, 5.4rem);
  font-weight: 500;
  line-height: 1.04;
  overflow-wrap: break-word;
}
.h-xl  { font-size: clamp(1.85rem, 4.4vw, 3.6rem); overflow-wrap: break-word; }
.h-lg  { font-size: clamp(1.7rem, 3vw, 2.7rem); }
.h-md  { font-size: clamp(1.3rem, 1.9vw, 1.8rem); }
.serif-italic { font-style: italic; }
.accent { color: var(--accent); }

.eyebrow {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.eyebrow::before {
  content: "";
  width: 22px; height: 1px;
  background: var(--accent);
  display: inline-block;
}
.eyebrow.center::after {
  content: "";
  width: 22px; height: 1px;
  background: var(--accent);
  display: inline-block;
}
.lead { font-size: clamp(1.05rem, 1.45vw, 1.28rem); color: var(--graphite); font-weight: 300; line-height: 1.65; }
.muted { color: var(--graphite); }

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: clamp(72px, 10vw, 140px); position: relative; }
.section.tight { padding-block: clamp(56px, 7vw, 96px); }
.grid { display: grid; gap: clamp(24px, 3vw, 48px); }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.col-span-2 { grid-column: span 2; }
.align-center { align-items: center; }

@media (max-width: 980px) {
  .cols-3, .cols-4 { grid-template-columns: repeat(2, 1fr); }
  .cols-2 { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .cols-3, .cols-4 { grid-template-columns: 1fr; }
  .col-span-2 { grid-column: auto; }
}

.section-head { max-width: 760px; margin-bottom: clamp(40px, 5vw, 72px); }
.section-head .eyebrow { margin-bottom: 22px; }
.section-head p { margin-top: 22px; }
.section-head.center { margin-inline: auto; text-align: center; }

.theme-dark { background: var(--ink); color: rgba(255,255,255,.82); }
.theme-dark h1, .theme-dark h2, .theme-dark h3, .theme-dark h4 { color: #fff; }
.theme-dark .muted, .theme-dark .lead { color: rgba(255,255,255,.62); }
.theme-dark .line { border-color: var(--line-light); }

.frame {
  border: var(--frame);
  background: var(--paper);
}
.theme-dark .frame { border-color: var(--line-light); background: transparent; }
.frame-pad { padding: clamp(20px, 3vw, 36px); }
.hairline { height: 1px; background: var(--line); border: 0; }
.theme-dark .hairline { background: var(--line-light); }

/* ---------- Buttons ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 44px;
  padding: 14px 28px;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-radius: 0;
  overflow: hidden;
  transition: color .45s var(--ease), border-color .45s var(--ease), background .45s var(--ease);
  will-change: transform;
  cursor: pointer;
}
.btn .icon { width: 16px; height: 16px; transition: transform .45s var(--ease); }
.btn:hover .icon { transform: translateX(4px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.btn-fill { background: var(--ink); color: #fff; }
.btn-fill::after {
  content: ""; position: absolute; inset: 0; z-index: 0;
  background: var(--accent);
  transform: scaleX(0); transform-origin: left;
  transition: transform .55s var(--ease);
}
.btn-fill:hover::after { transform: scaleX(1); }
.btn-fill > * { position: relative; z-index: 1; }

.btn-accent { background: var(--accent); color: #fff; }
.btn-accent::after {
  content: ""; position: absolute; inset: 0; z-index: 0;
  background: var(--ink);
  transform: scaleX(0); transform-origin: left;
  transition: transform .55s var(--ease);
}
.btn-accent:hover::after { transform: scaleX(1); }
.btn-accent > * { position: relative; z-index: 1; }

.btn-line { border: 1px solid var(--line); color: var(--ink); background: transparent; }
.btn-line:hover { border-color: var(--ink); }
.theme-dark .btn-line { border-color: var(--line-light); color: #fff; }
.theme-dark .btn-line:hover { border-color: var(--accent); color: var(--accent-soft); }

.link-u {
  position: relative;
  font-weight: 500;
  letter-spacing: .04em;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding-bottom: 3px;
  min-height: 44px;
}
.link-u::after {
  content: ""; position: absolute; left: 0; bottom: 8px;
  width: 100%; height: 1px; background: currentColor;
  transform: scaleX(0); transform-origin: right;
  transition: transform .5s var(--ease);
}
.link-u:hover::after { transform: scaleX(1); transform-origin: left; }
.link-u .icon { width: 15px; height: 15px; transition: transform .4s var(--ease); }
.link-u:hover .icon { transform: translateX(4px); }
.link-u:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- Lucide icons as masks (vendored SVGs, not hand-drawn) ---------- */
.icon {
  display: inline-block;
  width: 20px; height: 20px;
  background-color: currentColor;
  -webkit-mask: var(--ico) center / contain no-repeat;
  mask: var(--ico) center / contain no-repeat;
  flex: none;
}
.icon-lg { width: 28px; height: 28px; }
.icon-arrow-right { --ico: url("../icons/arrow-right.svg"); }
.icon-chevron-right { --ico: url("../icons/chevron-right.svg"); }
.icon-mail { --ico: url("../icons/mail.svg"); }
.icon-map-pin { --ico: url("../icons/map-pin.svg"); }
.icon-cpu { --ico: url("../icons/cpu.svg"); }
.icon-headphones { --ico: url("../icons/headphones.svg"); }
.icon-smartphone { --ico: url("../icons/smartphone.svg"); }
.icon-battery { --ico: url("../icons/battery-charging.svg"); }
.icon-lamp { --ico: url("../icons/lamp.svg"); }
.icon-shirt { --ico: url("../icons/shirt.svg"); }
.icon-warehouse { --ico: url("../icons/warehouse.svg"); }
.icon-ship { --ico: url("../icons/ship.svg"); }
.icon-clipboard { --ico: url("../icons/clipboard-check.svg"); }
.icon-factory { --ico: url("../icons/factory.svg"); }
.icon-globe { --ico: url("../icons/globe.svg"); }
.icon-package { --ico: url("../icons/package.svg"); }
.icon-truck { --ico: url("../icons/truck.svg"); }
.icon-search { --ico: url("../icons/search.svg"); }
.icon-file-check { --ico: url("../icons/file-check.svg"); }
.icon-layers { --ico: url("../icons/layers.svg"); }
.icon-users { --ico: url("../icons/users.svg"); }
.icon-building { --ico: url("../icons/building-2.svg"); }
.icon-circuit { --ico: url("../icons/circuit-board.svg"); }
.icon-zap { --ico: url("../icons/zap.svg"); }
.icon-box { --ico: url("../icons/box.svg"); }
.icon-shield { --ico: url("../icons/shield-check.svg"); }
.icon-scan { --ico: url("../icons/scan.svg"); }
.icon-scale { --ico: url("../icons/scale.svg"); }
.icon-file { --ico: url("../icons/file-text.svg"); }
.icon-check { --ico: url("../icons/check.svg"); }

/* ---------- Navigation ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px var(--gutter);
  transition: background .5s var(--ease), padding .5s var(--ease), box-shadow .5s var(--ease);
}
.nav.scrolled {
  background: rgba(244,242,236,.88);
  backdrop-filter: blur(14px) saturate(1.15);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  padding-block: 12px;
  box-shadow: 0 1px 0 var(--line-soft);
}
.nav.on-dark:not(.scrolled) {
  color: #fff;
  background: linear-gradient(to bottom, rgba(15,26,30,.72), rgba(15,26,30,0));
}
.nav.on-dark:not(.scrolled) .brand-mark {
  background: var(--paper); color: var(--ink);
}
.nav.on-dark:not(.scrolled) .nav-link::after { background: #fff; }
.nav.on-dark:not(.scrolled) .btn-fill {
  background: var(--paper); color: var(--ink);
}
.nav.on-dark:not(.scrolled) .btn-fill::after { background: var(--accent); }

.brand { display: flex; align-items: center; gap: 12px; z-index: 3; }
.brand:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.brand-mark {
  width: 36px; height: 36px; flex: none;
  display: grid; place-items: center;
  background: var(--ink); color: var(--paper);
  font-family: var(--font-display);
  font-weight: 600; font-size: 1.15rem; line-height: 1;
  border-bottom: 3px solid var(--accent);
  transition: background .45s var(--ease), color .45s var(--ease);
}
.nav.scrolled .brand-mark { background: var(--ink); color: var(--paper); }
.brand-name {
  font-family: var(--font-display);
  font-size: 1.22rem; font-weight: 600; letter-spacing: .01em; line-height: 1;
}
.brand-name b { color: var(--accent); font-weight: 600; }
.brand-sub {
  display: block; font-family: var(--font-body);
  font-size: 0.56rem; letter-spacing: 0.28em; text-transform: uppercase;
  color: var(--graphite); margin-top: 4px; font-weight: 500;
}
.nav.on-dark:not(.scrolled) .brand-sub { color: rgba(255,255,255,.62); }

.nav-links { display: flex; align-items: center; gap: clamp(16px, 2.1vw, 32px); }
.nav-link {
  position: relative; font-size: 0.82rem; font-weight: 500;
  letter-spacing: 0.03em; padding: 10px 0;
  min-height: 44px; display: inline-flex; align-items: center;
}
.nav-link::after {
  content: ""; position: absolute; left: 0; bottom: 6px; width: 100%; height: 1px;
  background: var(--ink); transform: scaleX(0); transform-origin: right;
  transition: transform .45s var(--ease);
}
.nav-link:hover::after, .nav-link.active::after { transform: scaleX(1); transform-origin: left; }
.nav-link.active { color: var(--accent); }
.nav-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.nav-cta { margin-left: 8px; }
.nav-actions { display: flex; align-items: center; gap: 18px; z-index: 3; }

.nav-toggle {
  display: none; width: 44px; height: 44px; position: relative; z-index: 6;
  flex: none; border: 1px solid currentColor;
}
.nav-toggle span {
  position: absolute; left: 10px; width: 24px; height: 2px; background: currentColor;
  transition: transform .4s var(--ease), opacity .3s;
}
.nav-toggle span:nth-child(1) { top: 15px; }
.nav-toggle span:nth-child(2) { top: 21px; }
.nav-toggle span:nth-child(3) { top: 27px; }
.nav-open .nav-toggle span:nth-child(1) { top: 21px; transform: rotate(45deg); }
.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
.nav-open .nav-toggle span:nth-child(3) { top: 21px; transform: rotate(-45deg); }

@media (max-width: 980px) {
  .nav-cta { display: none; }
  .nav-toggle {
    display: block;
    position: fixed;
    right: 12px;
    top: 14px;
    z-index: 210;
    background: var(--paper);
    color: var(--ink);
    border: 1px solid var(--ink);
  }
  .nav-toggle span { background: currentColor; }
  .brand { z-index: 6; padding-right: 56px; }
  .nav-links {
    position: fixed; inset: 0; flex-direction: column; justify-content: center;
    gap: 8px; background: var(--ink); color: #fff; z-index: 4;
    clip-path: circle(0% at calc(100% - 44px) 36px);
    transition: clip-path .7s var(--ease); pointer-events: none;
  }
  .nav-open .nav-links { clip-path: circle(150% at calc(100% - 44px) 36px); pointer-events: auto; }
  .nav-link { font-family: var(--font-display); font-size: 2rem; opacity: 0; transform: translateY(18px); transition: opacity .5s var(--ease), transform .5s var(--ease); }
  .nav-link::after { background: #fff; }
  .nav-open .nav-link { opacity: 1; transform: none; transition-delay: calc(.2s + var(--i, 0) * .06s); }
  .nav-open .nav-toggle {
    background: transparent;
    color: #fff;
    border-color: rgba(255,255,255,.55);
  }
}

.scroll-progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 100%;
  transform: scaleX(0); transform-origin: left;
  background: var(--accent); z-index: 300;
}

/* ---------- Footer ---------- */
.footer { background: var(--ink); color: rgba(255,255,255,.62); padding-top: clamp(72px, 9vw, 120px); position: relative; overflow: hidden; }
.footer-top { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.3fr; gap: 48px; padding-bottom: 64px; border-bottom: 1px solid var(--line-light); }
.footer h4 { color: #fff; font-family: var(--font-body); font-size: 0.72rem; letter-spacing: 0.2em; text-transform: uppercase; font-weight: 600; margin-bottom: 24px; }
.footer-brand .brand-name { color: #fff; font-size: 1.55rem; }
.footer-brand .brand-mark { margin-bottom: 16px; }
.footer-brand p { margin-top: 18px; max-width: 340px; line-height: 1.7; }
.footer-nav li { margin-bottom: 10px; }
.footer-nav a {
  position: relative; transition: color .35s var(--ease);
  display: inline-flex; min-height: 36px; align-items: center;
}
.footer-nav a:hover { color: var(--accent-soft); }
.footer-nav a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.footer-contact a { color: #fff; font-size: 1.05rem; transition: color .35s; }
.footer-contact a:hover { color: var(--accent-soft); }
.footer-contact .addr { margin-top: 14px; font-size: 0.9rem; line-height: 1.6; max-width: 280px; }
.footer-contact .meta { margin-top: 16px; font-size: 0.78rem; letter-spacing: .04em; }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; padding-block: 34px; font-size: 0.78rem; }
.footer-mega {
  font-family: var(--font-display);
  font-size: clamp(3rem, 14vw, 12rem);
  line-height: .8; color: rgba(255,255,255,.04);
  text-align: center; padding-bottom: 12px; user-select: none; letter-spacing: .02em;
}
@media (max-width: 880px) {
  .footer-top { grid-template-columns: 1fr 1fr; gap: 40px; }
  .footer-brand { grid-column: 1 / -1; }
}

/* ---------- Cursor / veil / reveals ---------- */
.cursor-dot, .cursor-ring {
  position: fixed; top: 0; left: 0; border-radius: 50%;
  pointer-events: none; z-index: 999; mix-blend-mode: difference; will-change: transform;
}
.cursor-dot { width: 6px; height: 6px; background: #fff; margin: -3px 0 0 -3px; }
.cursor-ring {
  width: 40px; height: 40px; border: 1px solid rgba(255,255,255,.5);
  margin: -20px 0 0 -20px;
  transition: width .35s var(--ease), height .35s var(--ease), margin .35s var(--ease), border-color .35s;
}
.cursor-ring.hover { width: 68px; height: 68px; margin: -34px 0 0 -34px; border-color: #fff; }
@media (hover: none), (pointer: coarse) { .cursor-dot, .cursor-ring { display: none; } }

.veil { position: fixed; inset: 0; z-index: 800; background: var(--ink); transform: scaleY(0); transform-origin: bottom; pointer-events: none; }
.veil.in { transform: scaleY(1); transform-origin: bottom; transition: transform .6s var(--ease); }
.veil.out { transform: scaleY(0); transform-origin: top; transition: transform .6s var(--ease); }

[data-reveal] { opacity: 0; transform: translateY(34px); transition: opacity 1s var(--ease), transform 1s var(--ease); will-change: transform, opacity; }
[data-reveal].in { opacity: 1; transform: none; }
[data-reveal-delay="1"] { transition-delay: .1s; }
[data-reveal-delay="2"] { transition-delay: .2s; }
[data-reveal-delay="3"] { transition-delay: .3s; }
[data-reveal-delay="4"] { transition-delay: .4s; }

.reveal-img { position: relative; overflow: hidden; }
.reveal-img img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.18); transition: transform 1.6s var(--ease); }
.reveal-img::after { content: ""; position: absolute; inset: 0; background: var(--paper); transform: scaleY(1); transform-origin: bottom; transition: transform 1s var(--ease); z-index: 2; }
.reveal-img.theme-dark-mask::after { background: var(--ink); }
.reveal-img.in img { transform: scale(1); }
.reveal-img.in::after { transform: scaleY(0); }

.split-line { display: block; overflow: hidden; }
.split-line > span { display: block; transform: translateY(105%); transition: transform .9s var(--ease); }
.split-line > span.in { transform: none; }
.word { display: inline-block; overflow: hidden; vertical-align: top; }
.word > span { display: inline-block; transform: translateY(105%); transition: transform .8s var(--ease); }
.word.in > span { transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  [data-reveal], .split-line > span, .word > span { opacity: 1 !important; transform: none !important; }
  .reveal-img img { transform: none !important; }
  .reveal-img::after { display: none; }
  .cursor-dot, .cursor-ring { display: none; }
}
