@font-face {
  font-family: "JetBrains Mono";
  src: url("assets/fonts/jetbrains-mono-var.woff2") format("woff2");
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
}

@font-face {
  font-family: "Noto Sans SC";
  src: url("assets/fonts/noto-sans-sc-subset.woff2") format("woff2");
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
}

.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  padding: 0;
  flex: 0 0 40px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: transparent;
  border: 1px solid var(--line-2);
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
  transition: transform 0.25s ease, opacity 0.2s ease;
}

.nav.open .nav-toggle span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav.open .nav-toggle span:nth-child(2) {
  opacity: 0;
}

.nav.open .nav-toggle span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.hp-field {
  position: absolute;
  left: -9999px;
  top: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.dbm-toast {
  position: fixed;
  top: 76px;
  left: 50%;
  z-index: 9999;
  max-width: min(88vw, 480px);
  padding: 16px 26px;
  text-align: center;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent-2);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  animation: dbm-toast 1.5s ease forwards;
}

.dbm-toast.is-error {
  border-top-color: #e26d6d;
}

.dbm-toast .t-en {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
}

.dbm-toast .t-cn {
  margin-top: 4px;
  font-family: var(--cn);
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-2);
}

@keyframes dbm-toast {
  0% {
    opacity: 0;
    transform: translate(-50%, -12px);
  }
  12%,
  80% {
    opacity: 1;
    transform: translate(-50%, 0);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -8px);
  }
}

@media (max-width: 1200px) {
  html,
  body {
    min-width: 0;
    max-width: 100%;
  }

  .nav {
    padding-inline: 24px;
  }

  .nav-toggle {
    display: flex;
  }

  .nav .links {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    z-index: 49;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin-left: 0;
    padding: 6px 24px 16px;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.98);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 18px 30px rgba(16, 35, 26, 0.08);
  }

  .nav.open .links {
    display: flex;
  }

  .nav .links > a,
  .nav .links .has-sub > a {
    width: 100%;
    min-height: 50px;
    padding: 15px 0;
    border-bottom: 1px solid var(--line);
  }

  .nav .links .has-sub {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .nav .links .sub {
    position: static;
    display: flex;
    min-width: 0;
    padding: 0 0 8px 14px;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .nav .links .sub a {
    padding: 11px 8px;
    border-bottom: 0;
  }

  .nav .right {
    margin-left: auto;
    gap: 12px;
  }

  .hero {
    height: auto;
    /* 100vh first: Safari < 15.4 drops the svh line and keeps this one. */
    min-height: 100vh;
    min-height: 100svh;
    padding-top: 96px;
    padding-bottom: 64px;
  }

  .hero-inner {
    grid-template-columns: 1fr;
    gap: 34px;
    height: auto;
  }

  .hero .meta-row {
    display: none;
  }

  .hero-radar {
    width: min(100%, 520px);
    margin-inline: auto;
  }

  .mp-hero {
    min-height: calc(100vh - 64px);
    min-height: calc(100svh - 64px);
  }

  .s-product .sticky-track {
    grid-template-columns: 1fr;
  }

  .s-product .left {
    position: static;
    height: auto;
    padding: 48px var(--pad-x);
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .s-product .right {
    padding: 56px var(--pad-x);
    gap: 56px;
  }

  .s-product .step {
    min-height: 0;
  }

  .s-contact .form-wrap {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .s-contact .info {
    position: static;
  }

  .footer .row {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }

  .footer .brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  :root {
    --pad-x: 20px;
  }

  html,
  body {
    max-width: 100%;
    overflow-x: clip;
  }

  .nav {
    padding-inline: 14px;
  }

  .nav .brand {
    min-width: 42px;
  }

  .nav .right {
    gap: 8px;
  }

  .nav .cta {
    min-height: 40px;
    padding: 8px 12px;
    font-size: 10px;
    letter-spacing: 0.12em;
  }

  .nav .lang button {
    min-width: 34px;
    padding: 6px 9px;
  }

  .section {
    padding: 72px var(--pad-x);
  }

  .hero {
    min-height: 0;
    padding-top: 96px;
  }

  .hero h1 {
    font-size: clamp(36px, 11vw, 54px);
    overflow-wrap: anywhere;
  }

  .hero h1 .stack {
    white-space: normal;
  }

  [data-lang="cn"] .hero h1 {
    font-size: clamp(34px, 10vw, 48px);
  }

  .hero .lede {
    font-size: 13px;
  }

  .hero .cta-row {
    flex-direction: column;
    align-items: stretch;
  }

  .hero .cta-row a {
    justify-content: center;
    min-height: 52px;
    text-align: center;
  }

  .hero-radar {
    width: min(88vw, 360px);
  }

  .hero .mold-stage canvas {
    width: 100%;
    height: auto;
  }

  .section-title,
  .mp-hero h1 {
    font-size: clamp(32px, 9vw, 52px);
    overflow-wrap: anywhere;
  }

  .s-product .right {
    padding-inline: var(--pad-x);
  }

  .s-product .step h3 {
    font-size: clamp(30px, 8vw, 48px);
    overflow-wrap: anywhere;
  }

  .s-cases .cases,
  .cust-featured,
  .cust-oem-grid,
  .mp-two {
    grid-template-columns: minmax(0, 1fr);
  }

  .s-cases .case,
  .cust-inner,
  .cust-feat,
  .cust-title,
  .cust-feat-name,
  .cust-dom-head,
  .mp-two,
  .mp-two > *,
  .mp-snapshot,
  .s-mat .section-inner > .reveal {
    min-width: 0;
    max-width: 100%;
  }

  .cust-title,
  .cust-feat-name,
  .cust-feat-cat,
  .cust-dom-eyebrow,
  .cust-dom-sub {
    overflow-wrap: anywhere;
  }

  .cust-feat-top {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .cust-oem-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .oem-card {
    min-width: 0;
    padding: 20px 16px;
  }

  .oem-en,
  .oem-cn {
    overflow-wrap: anywhere;
  }

  .mp-table-wrap,
  .spec-table,
  .s-mat .section-inner > .reveal,
  .mp-two > .reveal {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .mp-table {
    min-width: 540px;
  }

  .mp-caption,
  .spec-foot {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .s-colors .color-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .s-contact form {
    min-width: 0;
    padding: 18px;
  }

  .s-contact form .row {
    grid-template-columns: 1fr;
  }

  .cf-turnstile,
  .cf-turnstile iframe {
    max-width: 100%;
  }

  .footer .row {
    grid-template-columns: 1fr;
  }

  .footer .brand {
    grid-column: auto;
  }
}

@supports not (overflow: clip) {
  @media (max-width: 760px) {
    html,
    body {
      overflow-x: hidden;
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  .nav-toggle span {
    transition: none;
  }
}

/* ════════════════════════════════════════════════════════════════════════
   CROSS-BROWSER + TOUCH
   dbm-landing.css and dbm-tweaks.css are overwritten verbatim from the
   reference design on every sync, so every fix below has to live here.
   ════════════════════════════════════════════════════════════════════════ */

/* iOS inflates body text in landscape unless this is pinned. */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* WebKit paints an opaque grey block over tapped controls by default. */
a,
button,
label,
summary,
input,
select,
textarea {
  -webkit-tap-highlight-color: rgba(31, 157, 87, 0.14);
}

/* Safari needs the prefix for both of these; the reference file only prefixes some. */
.cube .face {
  -webkit-backdrop-filter: blur(2px);
}

.io-slot,
.io-toolbar,
.io-handle {
  -webkit-user-select: none;
}

/* Safari ignores background/border on a select until appearance is reset, which
   also removes the native arrow — so draw one back. */
.s-contact form select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 34px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-3) 50%),
    linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 18px) center, calc(100% - 13px) center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

/* Safari < 16.2 drops any declaration containing color-mix(), which would take
   the grid lines and focus/CTA halos with it. Restore them as flat rgba. */
@supports not (color: color-mix(in srgb, red 50%, transparent)) {
  :root {
    --glow-strong: rgba(31, 157, 87, 0.45);
    --glow-mid: rgba(31, 157, 87, 0.33);
    --glow-soft: rgba(31, 157, 87, 0.2);
    --grid-color: rgba(31, 157, 87, 0.09);
  }

  html[data-atmos="clean"] {
    --glow-strong: rgba(31, 157, 87, 0.16);
    --glow-mid: rgba(31, 157, 87, 0.11);
    --glow-soft: transparent;
  }
}

/* Touch devices: iOS Safari zooms the whole page when a focused control renders
   below 16px, and the reference sizes form text at 12-13px. */
@media (max-width: 1200px), (hover: none) and (pointer: coarse) {
  .s-contact form input,
  .s-contact form select,
  .s-contact form textarea,
  .s-contact form input[type="file"] {
    font-size: 16px;
  }

  .s-contact form input,
  .s-contact form select {
    min-height: 48px;
  }
}

/* Touch targets: the reference lays these out for a mouse, so several land far
   below the 44px guidance — footer links sit at 16px tall. */
@media (max-width: 1200px), (hover: none) and (pointer: coarse) {
  .footer ul {
    gap: 0;
  }

  .footer ul a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }

  .nav .lang button {
    min-height: 44px;
    min-width: 44px;
    padding-block: 0;
  }

  .nav .cta,
  .nav-toggle {
    min-height: 44px;
  }

  /* Sub-menu links inside the open drawer sit at 40px on padding alone. */
  .nav .links .sub a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }

  .nav-toggle {
    flex-basis: 44px;
    width: 44px;
  }

  .nav .brand {
    min-height: 44px;
  }

  .s-contact form .checks label {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }
}
