/* ---------- SELF-HOSTED FONTS ---------- */
/* Download the woff2 files into /fonts — see README. Both are SIL OFL 1.1. */
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 400 700;              /* variable range */
  font-display: swap;
  src: url("/fonts/SpaceGrotesk-Variable.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/fonts/Inter-Variable.woff2") format("woff2");
}

:root {
  --bg:        #0B0E0F;
  --panel:     #12161A;
  --panel-2:   #0E1214;
  --line:      #1E2529;
  --text:      #EAECED;
  --muted:     #8B9398;

  /* Technology practice — cool teal */
  --tech:      #00BFA5;
  --tech-dim:  #0C8C7A;
  --tech-soft: rgba(0,191,165,.14);

  /* Production practice — warm amber */
  --prod:      #E0A34E;
  --prod-dim:  #B47C2E;
  --prod-soft: rgba(224,163,78,.14);

  --max:       1080px;
  --ease:      cubic-bezier(.22,.61,.36,1);

  /* CJK fallback stack so Chinese renders well without a heavy webfont */
  --cjk: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  --font-body:    "Inter", system-ui, -apple-system, Arial, var(--cjk);
  --font-display: "Space Grotesk", system-ui, Arial, var(--cjk);
}

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

html { scroll-behavior: smooth; overflow-x: hidden; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Chinese benefits from slightly looser line-height for readability */
html[lang="zh-Hans"] body { line-height: 1.8; }

.skip-link {
  position: absolute; top: 0; left: 0;
  width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); clip-path: inset(50%); white-space: nowrap;
  background: var(--tech); color: #001; padding: .6rem 1rem;
  border-radius: 0 0 8px 0; z-index: 100; font-weight: 600;
}
.skip-link:focus {
  width: auto; height: auto; overflow: visible; clip: auto; clip-path: none; white-space: normal;
}

a { color: inherit; }
:focus-visible { outline: 2px solid var(--tech); outline-offset: 3px; border-radius: 3px; }

h1, h2, h3 { font-family: var(--font-display); letter-spacing: -.02em; line-height: 1.12; }
html[lang="zh-Hans"] h1,
html[lang="zh-Hans"] h2,
html[lang="zh-Hans"] h3 { letter-spacing: 0; line-height: 1.28; }

/* ---------- NAV ---------- */
.site-nav {
  position: sticky; top: 0; z-index: 55;
  background: rgba(11,14,15,.72);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: var(--max); margin: 0 auto;
  padding: .9rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
}
.brand {
  display: flex; align-items: center; gap: .6rem;
  text-decoration: none; font-family: var(--font-display);
  font-weight: 700; font-size: 1.15rem; letter-spacing: -.02em;
}
.brand-mark { width: 26px; height: 26px; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.brand-seam  { stroke: var(--text); }
.brand-left  { stroke: var(--tech); }
.brand-right { stroke: var(--prod); }
.nav-links { display: flex; align-items: center; gap: 1.8rem; }
.nav-links a { text-decoration: none; color: var(--muted); font-size: .95rem; font-weight: 500; transition: color .2s var(--ease); }
.nav-links a[href="#technology"]:hover { color: var(--tech); }
.nav-links a[href="#production"]:hover { color: var(--prod); }
.nav-cta {
  color: var(--text) !important;
  border: 1px solid var(--line);
  padding: .4rem .9rem; border-radius: 999px;
  transition: border-color .2s var(--ease), color .2s var(--ease) !important;
}
.nav-cta:hover { border-color: var(--text); }

/* Language toggle */
.lang-toggle {
  display: inline-flex; align-items: center; gap: .15rem;
  background: none; border: 1px solid var(--line); border-radius: 999px;
  padding: .35rem .75rem; cursor: pointer;
  font-family: var(--font-display); font-size: .82rem; font-weight: 500;
  color: var(--muted); transition: border-color .2s var(--ease), color .2s var(--ease);
}
.lang-toggle:hover { border-color: var(--text); color: var(--text); }
.lang-toggle .lang-sep { opacity: .5; margin: 0 .1rem; }
.lang-toggle .lang-en { color: var(--text); }
.lang-toggle .lang-zh { color: var(--muted); }
.lang-toggle.is-zh .lang-en { color: var(--muted); }
.lang-toggle.is-zh .lang-zh { color: var(--text); }

/* ---------- LAYOUT PRIMITIVES ---------- */
.block { max-width: var(--max); margin: 0 auto; padding: 6rem 1.5rem; }
.section-tag {
  font-family: var(--font-display);
  font-size: .8rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 2rem; font-weight: 500;
}
.practice-tech .section-tag { color: var(--tech); }
.practice-prod .section-tag { color: var(--prod); }

/* ---------- HERO ---------- */
.hero {
  position: relative;
  max-width: var(--max); margin: 0 auto;
  padding: 7rem 1.5rem 6rem;
  display: grid; grid-template-columns: 1fr 120px; gap: 2rem;
  min-height: calc(100vh - 60px);
  min-height: calc(100dvh - 60px);
  align-items: center;
}
.hero-inner { max-width: 760px; animation: rise .8s var(--ease) both; }
.eyebrow {
  font-family: var(--font-display);
  color: var(--muted); text-transform: uppercase; letter-spacing: .16em;
  font-size: .82rem; margin-bottom: 1.4rem;
}
html[lang="zh-Hans"] .eyebrow { letter-spacing: .1em; }
.hero h1 { font-size: clamp(2.4rem, 6vw, 4.2rem); font-weight: 700; margin-bottom: 1.6rem; }
.lede { color: var(--muted); font-size: 1.12rem; max-width: 42rem; margin-bottom: 2.6rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 1rem; }

/* Signature seam — a divider between the two practices */
.hero-seam {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1rem; height: 100%;
}
.seam-line {
  width: 2px; flex: 1;
  background: linear-gradient(180deg, transparent, var(--tech) 15%, var(--tech) 46%, var(--muted) 50%, var(--prod) 54%, var(--prod) 85%, transparent);
  animation: seamGrow 1.2s var(--ease) both .3s;
  transform-origin: center;
}
.seam-label {
  writing-mode: vertical-rl;
  font-family: var(--font-display);
  font-size: .72rem; letter-spacing: .3em; text-transform: uppercase;
}
.seam-tech { color: var(--tech); }
.seam-prod { color: var(--prod); }
.seam-top { transform: rotate(180deg); }

/* ---------- BUTTONS ---------- */
.btn, .btn-ghost {
  display: inline-block; text-decoration: none;
  padding: .85rem 1.7rem; border-radius: 999px;
  font-weight: 600; font-size: .98rem;
  transition: transform .2s var(--ease), background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
  border: 1px solid transparent; cursor: pointer;
}
.btn-tech { background: var(--tech); color: #001513; }
.btn-tech:hover { background: #24d3ba; transform: translateY(-2px); }
.btn-prod { background: var(--prod); color: #1c1204; }
.btn-prod:hover { background: #edb768; transform: translateY(-2px); }
.btn-ghost { border-color: var(--line); color: var(--text); }
.btn-ghost:hover { border-color: var(--text); }

/* ---------- SPLIT NOTE (divider statement) ---------- */
.split-note { background: var(--panel-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.split-inner { padding: 2.4rem 1.5rem; display: flex; align-items: center; gap: 1.5rem; }
.split-inner p { color: var(--muted); font-size: .98rem; text-align: center; flex: 0 1 auto; }
.split-rule { height: 1px; flex: 1; }
.split-rule-tech { background: linear-gradient(90deg, transparent, var(--tech-dim)); }
.split-rule-prod { background: linear-gradient(90deg, var(--prod-dim), transparent); }

/* ---------- PRACTICE BLOCKS ---------- */
.practice { border-top: 1px solid var(--line); position: relative; }
.practice::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.practice-tech { background: var(--bg); }
.practice-tech::before { background: linear-gradient(90deg, var(--tech), transparent 60%); }
.practice-prod { background: var(--panel-2); }
.practice-prod::before { background: linear-gradient(90deg, var(--prod), transparent 60%); }

.practice-head { display: flex; align-items: center; gap: 1.2rem; margin-bottom: 1.8rem; }
.practice-icon svg { width: 48px; height: 48px; stroke: currentColor; }
.practice-tech .practice-icon { color: var(--tech); }
.practice-prod .practice-icon { color: var(--prod); }
.practice-head h2 { font-size: clamp(1.7rem, 3.6vw, 2.5rem); font-weight: 600; }
.practice-kicker {
  font-family: var(--font-display); font-size: .9rem;
  letter-spacing: .04em; margin-top: .2rem;
}
.practice-tech .practice-kicker { color: var(--tech); }
.practice-prod .practice-kicker { color: var(--prod); }
.practice-lede { color: var(--muted); font-size: 1.08rem; max-width: 44rem; margin-bottom: 2rem; }

.feature-list { list-style: none; max-width: 44rem; margin-bottom: 2.4rem; }
.feature-list li {
  color: var(--text); font-size: .98rem; padding: .7rem 0 .7rem 1.6rem;
  position: relative; border-top: 1px solid var(--line);
}
.feature-list li:first-child { border-top: none; }
.feature-list li::before {
  content: ""; position: absolute; left: 0; top: 50%;
  width: 7px; height: 7px; margin-top: -3.5px;
  border-radius: 2px; transform: rotate(45deg);
}
.practice-tech .feature-list li::before { border: 1.5px solid var(--tech); }
.practice-prod .feature-list li::before { border: 1.5px solid var(--prod); }
.practice-cta { margin-top: .4rem; }

/* ---------- CONTACT ---------- */
.contact { background: var(--bg); border-top: 1px solid var(--line); }
.contact .section-tag { color: var(--muted); }
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; align-items: start; }
.contact-intro h2 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); font-weight: 600; margin-bottom: 1.2rem; }
.contact-intro p { color: var(--muted); }

.contact-form { display: flex; flex-direction: column; gap: 1.2rem; }
.field { display: flex; flex-direction: column; gap: .5rem; }
.field label { font-size: .85rem; font-weight: 500; color: var(--muted); }
.field input, .field textarea, .field select {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: .8rem 1rem; color: var(--text); font: inherit;
  font-size: 16px; /* 16px minimum prevents iOS Safari auto-zoom on focus */
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
  resize: vertical;
}
.field select { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238B9398' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 1rem center; padding-right: 2.4rem;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--tech);
  box-shadow: 0 0 0 3px var(--tech-soft);
}
.hp {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0,0,0,0); clip-path: inset(50%); white-space: nowrap;
}
.cf-turnstile-wrap { margin: .2rem 0; min-height: 65px; }
.form-submit { border: none; background: var(--tech); color: #001513; align-self: flex-start; margin-top: .3rem; }
.form-submit:hover { background: #24d3ba; transform: translateY(-2px); }
.form-submit:disabled { opacity: .6; cursor: default; transform: none; }
.form-status { font-size: .92rem; min-height: 1.2rem; }
.form-status.is-success { color: var(--tech); }
.form-status.is-error { color: #ff6b6b; }

/* ---------- FOOTER ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--panel-2); }
.footer-inner {
  max-width: var(--max); margin: 0 auto; padding: 2.2rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1.2rem;
}
.footer-brand { font-family: var(--font-display); font-weight: 700; letter-spacing: -.02em; }
.footer-practices { display: flex; gap: 1.6rem; flex-wrap: wrap; }
.footer-practices a { text-decoration: none; color: var(--muted); font-size: .9rem; display: flex; align-items: center; gap: .5rem; transition: color .2s var(--ease); }
.footer-practices a:hover { color: var(--text); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-tech { background: var(--tech); }
.dot-prod { background: var(--prod); }
.footer-meta { color: var(--muted); font-size: .88rem; }

/* ---------- MOBILE NAV ELEMENTS (hidden on desktop by default) ---------- */
.nav-toggle {
  display: none;                 /* shown only in the mobile breakpoint */
  flex-direction: column; justify-content: center; gap: 5px;
  width: 44px; height: 44px;     /* full 44px tap target */
  padding: 0; margin: -6px -8px -6px 0;
  background: none; border: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.nav-toggle-bar {
  display: block; width: 22px; height: 2px; margin: 0 auto;
  background: var(--text); border-radius: 2px;
  transition: transform .25s var(--ease), opacity .2s var(--ease);
}
body.nav-open .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.nav-open .nav-toggle-bar:nth-child(2) { opacity: 0; }
body.nav-open .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-scrim {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(4,6,7,.6); backdrop-filter: blur(2px);
  opacity: 0; transition: opacity .25s var(--ease);
}
body.nav-open .nav-scrim { opacity: 1; }

/* Mobile horizontal seam — the signature, reworked for phones */
.hero-seam-mobile { display: none; }

/* Nicer tap feedback on all interactive elements, and momentum scroll */
.btn, .nav-cta, .lang-toggle, .practice-cta, .footer-practices a, .nav-links a {
  -webkit-tap-highlight-color: transparent;
}

/* ---------- MOTION ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes seamGrow { from { transform: scaleY(0); opacity: 0; } to { transform: scaleY(1); opacity: 1; } }

/* ---------- RESPONSIVE / MOBILE-OPTIMIZED ---------- */

/* Tablet / small desktop: collapse the two-column hero, keep full nav */
@media (max-width: 900px) and (min-width: 721px) {
  .hero { grid-template-columns: 1fr; min-height: auto; padding: 6rem 1.5rem 4rem; }
  .hero-seam { display: none; }
  .hero-seam-mobile { display: flex; }
  .contact-grid { grid-template-columns: 1fr; gap: 2.5rem; }
}

/* Phones: full mobile experience (hamburger, dvh hero, tuned rhythm) */
@media (max-width: 720px) {
  /* The header's backdrop-filter creates a containing block that would trap the
     position:fixed menu panel inside the header's box. Drop it on mobile and use
     a solid bar instead so the slide-in panel can fill the full viewport height. */
  .site-nav { backdrop-filter: none; background: var(--bg); }

  /* Respect the notch and home indicator */
  .nav-inner { padding: .8rem max(1.1rem, env(safe-area-inset-left)) .8rem max(1.1rem, env(safe-area-inset-right)); }
  .block { padding: 3.5rem 1.25rem; }

  /* --- Hamburger + slide-in menu --- */
  .nav-toggle { display: flex; position: relative; z-index: 60; }
  .nav-links {
    position: fixed; z-index: 45;
    top: 0; right: 0; bottom: 0;
    width: min(80vw, 320px);
    flex-direction: column; align-items: stretch; justify-content: flex-start;
    gap: 0;
    padding: calc(env(safe-area-inset-top) + 5rem) 1.5rem calc(env(safe-area-inset-bottom) + 2rem);
    background: var(--panel);
    border-left: 1px solid var(--line);
    transform: translateX(100%);
    transition: transform .28s var(--ease);
    overflow-y: auto; -webkit-overflow-scrolling: touch;
  }
  body.nav-open .nav-links { transform: translateX(0); }

  .nav-links a {
    font-size: 1.15rem; font-weight: 600; color: var(--text);
    padding: 1rem 0; border-bottom: 1px solid var(--line);
    display: flex; align-items: center; min-height: 52px;
  }
  .nav-links a[href="#technology"] { color: var(--tech); }
  .nav-links a[href="#production"] { color: var(--prod); }
  .nav-cta {
    color: var(--text) !important; border: none; border-radius: 0;
    padding: 1rem 0 !important; margin: 0;
  }
  .lang-toggle {
    margin-top: 1.5rem; align-self: flex-start;
    padding: .6rem 1.1rem; font-size: 1rem; min-height: 44px;
  }

  /* --- Hero: dynamic viewport height, tuned type --- */
  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 4rem 1.25rem 3rem;
  }
  .hero-inner { max-width: 100%; }
  .eyebrow { font-size: .78rem; margin-bottom: 1rem; }
  .hero h1 { font-size: clamp(2rem, 9vw, 2.9rem); margin-bottom: 1.2rem; }
  .lede { font-size: 1.05rem; margin-bottom: 2rem; }

  /* --- Primary actions: full-width, thumb-friendly, stacked --- */
  .hero-actions { flex-direction: column; gap: .75rem; }
  .hero-actions .btn {
    width: 100%; text-align: center;
    padding: 1rem 1.5rem; min-height: 52px;
    display: flex; align-items: center; justify-content: center;
  }

  /* --- Mobile seam: horizontal, under the hero copy --- */
  .hero-seam { display: none; }
  .hero-seam-mobile {
    display: flex; align-items: center; gap: 1rem;
    margin-top: 2.75rem;
  }
  .seam-m-label {
    font-family: var(--font-display); font-size: .72rem;
    letter-spacing: .18em; text-transform: uppercase; white-space: nowrap;
  }
  html[lang="zh-Hans"] .seam-m-label { letter-spacing: .1em; }
  .seam-m-line {
    flex: 1; height: 2px;
    background: linear-gradient(90deg, var(--tech) 0%, var(--tech) 42%, var(--muted) 50%, var(--prod) 58%, var(--prod) 100%);
    animation: seamGrowX 1s var(--ease) both .3s; transform-origin: center;
  }

  /* --- Sections: tighter rhythm --- */
  .section-tag { margin-bottom: 1.4rem; }
  .practice-head { gap: 1rem; margin-bottom: 1.4rem; }
  .practice-icon svg { width: 40px; height: 40px; }
  .practice-head h2 { font-size: clamp(1.6rem, 7vw, 2rem); }
  .practice-lede { font-size: 1.02rem; margin-bottom: 1.6rem; }
  .feature-list { margin-bottom: 2rem; }
  .feature-list li { font-size: 1rem; padding: .8rem 0 .8rem 1.6rem; }
  .practice-cta { width: 100%; text-align: center; padding: 1rem 1.5rem; min-height: 52px; }

  /* --- Split note --- */
  .split-inner { flex-direction: column; gap: .9rem; padding: 2rem 1.25rem; }
  .split-inner p { font-size: .95rem; }
  .split-rule { width: 50%; height: 1px; flex: none; }

  /* --- Contact --- */
  .contact-grid { grid-template-columns: 1fr; gap: 2rem; }
  .contact-intro h2 { font-size: clamp(1.6rem, 7vw, 2rem); }
  .field label { font-size: .9rem; }
  .form-submit { width: 100%; text-align: center; padding: 1rem 1.5rem; min-height: 52px; }

  /* --- Footer: stack, comfortable spacing --- */
  .footer-inner {
    flex-direction: column; align-items: flex-start; gap: 1.4rem;
    padding: 2rem 1.25rem calc(2rem + env(safe-area-inset-bottom));
  }
  .footer-practices { flex-direction: column; gap: 1rem; }
  .footer-practices a { min-height: 32px; }
}

/* Very small phones */
@media (max-width: 360px) {
  .hero h1 { font-size: 1.85rem; }
  .brand { font-size: 1.05rem; }
  .seam-m-label { font-size: .66rem; letter-spacing: .12em; }
}

/* Landscape phones: don't let a tall menu trap content */
@media (max-height: 480px) and (orientation: landscape) {
  .nav-links { padding-top: 4rem; }
  .hero { padding-top: 3rem; }
}

@keyframes seamGrowX { from { transform: scaleX(0); opacity: 0; } to { transform: scaleX(1); opacity: 1; } }
