/* =========================================================
   方寸万象 / FANGCUN WANXIANG
   Refined editorial minimalism — black & white
   ========================================================= */

:root {
  --ink: #0a0a0a;
  --ink-soft: #1a1a1a;
  --paper: #f5f3ee;
  --paper-warm: #efece4;
  --line: rgba(10, 10, 10, 0.14);
  --line-strong: rgba(10, 10, 10, 0.32);
  --muted: rgba(10, 10, 10, 0.55);

  --serif: "Instrument Serif", "Songti SC", "STSong", Georgia, serif;
  --sans:  "Inter Tight", -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono:  "JetBrains Mono", "SF Mono", Menlo, monospace;

  --pad-x: clamp(24px, 5vw, 96px);
  --max-w: 1440px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-padding-top: 96px;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
}

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

/* Keyboard focus */
:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 2px;
}
.btn:focus-visible,
.lang-toggle:focus-visible,
.product__form button:focus-visible {
  outline-offset: 4px;
}

/* ---------- Grain / paper texture ---------- */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: 0.35;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.08 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@media (max-width: 960px), (pointer: coarse) {
  .grain { display: none; }
}

/* ====================================================
   NAV
   ==================================================== */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 22px var(--pad-x);
  background: rgba(245, 243, 238, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.nav__brand {
  display: flex;
  flex-direction: column;
  line-height: 1;
  gap: 4px;
}
.brand-mark {
  font-family: var(--serif);
  font-size: 22px;
  letter-spacing: 0.02em;
}
.brand-en {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.nav__links {
  display: flex;
  gap: 38px;
  font-size: 13px;
  letter-spacing: 0.01em;
}
.nav__links a {
  position: relative;
  padding: 4px 0;
  transition: opacity 0.25s ease;
}
.nav__links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%;
  height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.35s ease;
}
.nav__links a:hover { opacity: 0.6; }
.nav__links a:hover::after { transform: scaleX(1); transform-origin: left; }

.lang-toggle {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: transparent;
  border: 1px solid var(--ink);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.3s ease;
}
.lang-toggle:hover {
  background: var(--ink);
  color: var(--paper);
}
.lang-divider { opacity: 0.45; }
[data-lang="zh"] .lang-zh { font-weight: 600; }
[data-lang="zh"] .lang-en { opacity: 0.45; }
[data-lang="en"] .lang-en { font-weight: 600; }
[data-lang="en"] .lang-zh { opacity: 0.45; }

/* ====================================================
   HERO
   ==================================================== */
.hero {
  position: relative;
  min-height: 100vh;
  padding: 180px var(--pad-x) 80px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 60px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.hero__meta {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--muted);
  animation: fadeUp 0.9s 0.1s both ease-out;
}
.meta-dot { font-size: 6px; }

.hero__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(64px, 13vw, 220px);
  line-height: 0.92;
  letter-spacing: -0.025em;
  align-self: center;
  max-width: 1100px;
}
.hero__line {
  display: block;
  overflow: hidden;
}
.hero__line span,
.hero__line em {
  display: inline-block;
  animation: rise 1.1s cubic-bezier(0.2, 0.7, 0.1, 1) both;
}
.hero__line--1 em {
  font-style: italic;
  animation-delay: 0.2s;
}
.hero__line--1 span {
  animation-delay: 0.32s;
}
.hero__line--2 {
  text-align: right;
  margin-top: -0.05em;
}
.hero__line--2 span {
  animation-delay: 0.45s;
}

.hero__bottom {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 60px;
  animation: fadeUp 1s 0.7s both ease-out;
}

.hero__lede {
  max-width: 460px;
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink-soft);
}

.hero__cta {
  display: flex;
  gap: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  font-size: 13px;
  letter-spacing: 0.02em;
  border-radius: 999px;
  border: 1px solid var(--ink);
  transition: all 0.35s cubic-bezier(0.2, 0.7, 0.1, 1);
  cursor: pointer;
  white-space: nowrap;
}
.btn svg { transition: transform 0.35s ease; }
.btn:hover svg { transform: translate(2px, -2px); }

.btn--primary {
  background: var(--ink);
  color: var(--paper);
}
.btn--primary:hover {
  background: var(--paper);
  color: var(--ink);
}
.btn--ghost {
  background: transparent;
  color: var(--ink);
}
.btn--ghost:hover {
  background: var(--ink);
  color: var(--paper);
}

.hero__vertical {
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%) rotate(180deg);
  writing-mode: vertical-rl;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--muted);
  animation: fadeIn 1.4s 1.2s both;
}

.hero__corner {
  position: absolute;
  top: 130px;
  right: var(--pad-x);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  font-family: var(--mono);
  animation: fadeIn 1.4s 1.4s both;
}
.corner-num {
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.corner-label {
  font-family: var(--serif);
  font-size: 16px;
  font-style: italic;
}

/* ====================================================
   MARQUEE
   ==================================================== */
.marquee {
  background: var(--ink);
  color: var(--paper);
  padding: 22px 0;
  overflow: hidden;
  border-bottom: 1px solid var(--ink);
}
.marquee__track {
  display: flex;
  gap: 48px;
  white-space: nowrap;
  animation: scroll 40s linear infinite;
  font-family: var(--serif);
  font-size: 22px;
  letter-spacing: 0.04em;
}
.marquee__track span {
  display: inline-block;
}

/* ====================================================
   SECTION HEADING SHARED
   ==================================================== */
.section-head {
  display: flex;
  align-items: center;
  gap: 18px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--muted);
  padding-bottom: 38px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 80px;
}
.section-head--light {
  color: rgba(245, 243, 238, 0.55);
  border-color: rgba(245, 243, 238, 0.18);
}
.section-num {
  font-weight: 500;
}
.section-label {
  text-transform: uppercase;
}

.section-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(40px, 6vw, 88px);
  line-height: 1;
  letter-spacing: -0.015em;
  margin-bottom: 80px;
}
.section-title em {
  font-style: italic;
  color: var(--muted);
}
.section-title--center {
  text-align: center;
  font-size: clamp(32px, 4.8vw, 72px);
}
@media (min-width: 720px) {
  .section-title--center { white-space: nowrap; }
}

/* ====================================================
   ABOUT
   ==================================================== */
.about {
  padding: 130px var(--pad-x);
  border-bottom: 1px solid var(--line);
}

.about__grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 100px;
}

.about__quote {
  font-family: var(--serif);
  font-size: clamp(40px, 5.5vw, 80px);
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.about__quote em {
  font-style: italic;
}

.about__body p {
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink-soft);
  margin-bottom: 24px;
  max-width: 480px;
}

.about__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 64px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stat__num {
  font-family: var(--serif);
  font-size: 44px;
  line-height: 1;
}
.stat__label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--muted);
}

/* ====================================================
   SERVICES
   ==================================================== */
.services {
  padding: 130px var(--pad-x);
  border-bottom: 1px solid var(--line);
}

.services__list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}
.service {
  position: relative;
  padding: 56px 48px 56px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  transition: background 0.4s ease, color 0.4s ease;
  cursor: default;
}
.service:hover {
  background: var(--ink);
  color: var(--paper);
}
.service:hover .service__num,
.service:hover .service__desc {
  color: rgba(245, 243, 238, 0.65);
}

.service__num {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin-bottom: 28px;
  transition: color 0.4s ease;
}
.service__name {
  font-family: var(--serif);
  font-size: 36px;
  font-weight: 400;
  line-height: 1.1;
  margin-bottom: 18px;
}
.service__desc {
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink-soft);
  max-width: 380px;
  transition: color 0.4s ease;
}

/* ====================================================
   CLIENTS / NUMBERS
   ==================================================== */
.clients {
  padding: 140px var(--pad-x) 150px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-warm);
  position: relative;
}

.clients__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.big-stat {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 80px;
  padding: 56px 48px 56px 0;
  border-right: 1px solid var(--line);
  min-height: 360px;
}
.big-stat:last-child { border-right: none; padding-right: 0; }
.big-stat:not(:first-child) { padding-left: 48px; }

.big-stat__top {
  display: flex;
  align-items: baseline;
  gap: 16px;
}
.big-stat__index {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--muted);
}
.big-stat__label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
}

.big-stat__num {
  font-family: var(--serif);
  font-size: clamp(96px, 14vw, 224px);
  line-height: 0.82;
  letter-spacing: -0.04em;
  display: flex;
  align-items: flex-start;
  white-space: nowrap;
}
.big-stat__num .count {
  font-variant-numeric: tabular-nums;
  display: inline-block;
}
.big-stat__suffix {
  font-style: italic;
  font-size: 0.42em;
  color: var(--muted);
  margin-left: 10px;
  margin-top: 0.18em;
  line-height: 1;
}

/* ====================================================
   PRODUCT (THINKFLOW)
   ==================================================== */
.product {
  position: relative;
  padding: 130px var(--pad-x);
  background: var(--ink);
  color: var(--paper);
  overflow: hidden;
}

.product__inner {
  position: relative;
  max-width: 880px;
  z-index: 2;
}

.product__name {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(64px, 11vw, 160px);
  line-height: 0.9;
  letter-spacing: -0.025em;
  margin-bottom: 28px;
}
.product__name-en {
  display: block;
  font-style: italic;
}
.product__name-cn {
  display: block;
  font-size: 22px;
  font-style: normal;
  letter-spacing: 0;
  margin-top: 18px;
  color: rgba(245, 243, 238, 0.6);
  font-family: var(--sans);
}

.product__desc {
  max-width: 580px;
  font-size: 17px;
  line-height: 1.7;
  color: rgba(245, 243, 238, 0.78);
  margin-bottom: 48px;
}

.product__features {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px 40px;
  margin-bottom: 56px;
  padding-top: 32px;
  border-top: 1px solid rgba(245, 243, 238, 0.18);
}
.product__features li {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  font-size: 15px;
  color: rgba(245, 243, 238, 0.85);
}
.feature__bullet {
  font-family: var(--mono);
  color: rgba(245, 243, 238, 0.5);
}

.product__form {
  display: flex;
  align-items: center;
  gap: 0;
  max-width: 540px;
  border: 1px solid rgba(245, 243, 238, 0.4);
  border-radius: 999px;
  padding: 4px 4px 4px 24px;
  background: rgba(245, 243, 238, 0.04);
  transition: border-color 0.3s ease;
}
.product__form:focus-within {
  border-color: var(--paper);
}
.product__form input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--paper);
  font-family: var(--sans);
  font-size: 14px;
  padding: 12px 0;
}
.product__form input::placeholder {
  color: rgba(245, 243, 238, 0.4);
}
.product__form button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  background: var(--paper);
  color: var(--ink);
  border: none;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.3s ease;
}
.product__form button:hover { transform: translateX(2px); }

.product__deco {
  position: absolute;
  right: -80px;
  top: 50%;
  transform: translateY(-50%);
  width: 360px;
  height: 360px;
  opacity: 0.6;
  pointer-events: none;
}
.deco-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  width: 100%;
  height: 100%;
  background: rgba(245, 243, 238, 0.18);
  border: 1px solid rgba(245, 243, 238, 0.18);
}
.deco-grid div {
  background: var(--ink);
  position: relative;
}
.deco-grid div::after {
  content: "";
  position: absolute;
  inset: 30%;
  background: rgba(245, 243, 238, 0.1);
  border-radius: 50%;
  animation: pulse 4s ease-in-out infinite;
}
.deco-grid div:nth-child(2n)::after { animation-delay: 0.4s; }
.deco-grid div:nth-child(3n)::after { animation-delay: 0.8s; }
.deco-grid div:nth-child(5n)::after { animation-delay: 1.2s; }

/* ====================================================
   CONTACT
   ==================================================== */
.contact {
  padding: 130px var(--pad-x);
  border-bottom: 1px solid var(--line);
}

.contact__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(48px, 8vw, 128px);
  line-height: 1;
  letter-spacing: -0.025em;
  margin-bottom: 96px;
  text-align: center;
  white-space: nowrap;
}
.contact__title em {
  font-style: italic;
  color: var(--muted);
}

.contact__cols {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 40px;
  padding-top: 40px;
  border-top: 1px solid var(--line);
  max-width: 720px;
  margin: 0 auto;
}
.contact__col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.contact__key {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-transform: uppercase;
}
.contact__val {
  font-family: var(--serif);
  font-size: 24px;
  position: relative;
  display: inline-block;
  width: fit-content;
}
a.contact__val::after {
  content: "";
  position: absolute;
  left: 0; bottom: 2px;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0.3);
  transform-origin: left;
  transition: transform 0.4s ease;
}
a.contact__val:hover::after { transform: scaleX(1); }

/* ====================================================
   FOOTER
   ==================================================== */
.footer {
  padding: 80px var(--pad-x) 32px;
  background: var(--paper-warm);
}
.footer__top {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 80px;
  align-items: center;
  padding-bottom: 60px;
  border-bottom: 1px solid var(--line);
}
.footer__brand {
  display: flex;
  flex-direction: column;
  line-height: 1;
  gap: 6px;
}
.footer__cn {
  font-family: var(--serif);
  font-size: 32px;
}
.footer__en {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--muted);
}
.footer__tag {
  font-family: var(--serif);
  font-style: italic;
  font-size: 22px;
  color: var(--muted);
  text-align: right;
  max-width: 460px;
  margin-left: auto;
}
.footer__bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 32px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
}

/* ====================================================
   ANIMATIONS
   ==================================================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes rise {
  from { transform: translateY(110%); }
  to { transform: translateY(0); }
}
@keyframes scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .marquee__track,
  .deco-grid div::after { animation: none !important; }
}

/* Reveal-on-scroll */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 1s cubic-bezier(0.2, 0.7, 0.1, 1), transform 1s cubic-bezier(0.2, 0.7, 0.1, 1);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ====================================================
   RESPONSIVE
   ==================================================== */
@media (max-width: 960px) {
  .nav {
    grid-template-columns: 1fr auto;
    padding: 18px var(--pad-x);
  }
  .nav__links { display: none; }

  .hero {
    padding: 140px var(--pad-x) 60px;
    gap: 40px;
    min-height: auto;
  }
  .hero__bottom {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .hero__cta { flex-wrap: wrap; }
  .hero__vertical { display: none; }
  .hero__corner { top: 90px; }

  .about__grid {
    grid-template-columns: 1fr;
    gap: 60px;
  }
  .about__stats { grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .stat__num { font-size: 32px; }

  .services__list {
    grid-template-columns: 1fr;
  }
  .service { padding: 40px 28px; }

  .product__features { grid-template-columns: 1fr; }
  .product__deco { display: none; }

  .clients { padding: 100px var(--pad-x) 110px; }
  .clients__grid { grid-template-columns: 1fr; }
  .big-stat {
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 48px 0 56px;
    gap: 32px;
    min-height: auto;
  }
  .big-stat:not(:first-child) { padding-left: 0; }
  .big-stat:last-child { border-bottom: none; padding-bottom: 8px; }
  .big-stat__num { font-size: clamp(96px, 26vw, 180px); }

  .contact__title {
    white-space: normal;
    font-size: clamp(40px, 11vw, 64px);
  }
  .contact__cols { grid-template-columns: 1fr; gap: 28px; text-align: center; }
  .contact__col { align-items: center; }
  .contact__val { font-size: 18px; }

  .footer__top {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .footer__tag { text-align: left; margin-left: 0; }
  .footer__bottom { flex-direction: column; gap: 12px; align-items: flex-start; }

  .marquee__track { font-size: 16px; }
}

@media (max-width: 560px) {
  :root { --pad-x: 22px; }
  .product__form {
    flex-direction: column;
    border-radius: 18px;
    padding: 12px;
    align-items: stretch;
  }
  .product__form input { padding: 12px 12px; }
  .product__form button { justify-content: center; padding: 14px; }
}

/* ====================================================
   ENGLISH MODE OVERRIDES (optical)
   ==================================================== */
[data-lang="en"] .hero__title { letter-spacing: -0.03em; }
[data-lang="en"] body { font-feature-settings: "ss01"; }
