/* ============================================================
   site.css — shared chrome + components
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-16);
  line-height: var(--lh-base);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* RTL adjustments */
html[dir="rtl"] body { font-family: 'Noto Sans Arabic', var(--font-body); }
html[dir="rtl"] .icon-arrow { transform: scaleX(-1); }

/* ---------- Typography ---------- */
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.02em; margin: 0; color: var(--ink); line-height: var(--lh-tight); }
h1 { font-size: var(--fs-display); }
h2 { font-size: var(--fs-display-sm); letter-spacing: -0.015em; }
h3 { font-size: var(--fs-24); letter-spacing: -0.01em; }
h4 { font-size: var(--fs-18); letter-spacing: 0; }
p { margin: 0; }
.eyebrow {
  font-size: 18px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--accent);
  display: inline-flex; align-items: center; gap: var(--space-2);
}
.eyebrow::before { content: ""; width: 24px; height: 1.5px; background: var(--accent); display: inline-block; }
html[dir="rtl"] .eyebrow { letter-spacing: 0; }

.lead { font-size: var(--fs-18); color: var(--ink-muted); line-height: var(--lh-loose); max-width: 60ch; }
.tabular { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); }

/* ---------- Layout primitives ---------- */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--space-6); }
.container--narrow { max-width: var(--container-narrow); }
.section { padding: clamp(4rem, 8vw, 7rem) 0; }
.section--tight { padding: clamp(3rem, 5vw, 4rem) 0; }
.section--alt { background: var(--surface-alt); }
.section--ink { background: var(--brand-900); color: #fff; }
.section--ink h1, .section--ink h2, .section--ink h3, .section--ink h4 { color: #fff; }
.section--ink .lead { color: #B8C6DA; }

.section-head { display: grid; gap: var(--space-3); margin-bottom: var(--space-12); max-width: 720px; }
.section-head--center { margin-left: auto; margin-right: auto; text-align: center; }
.section-head--split { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: var(--space-6); max-width: none; }
@media (max-width: 720px) { .section-head--split { grid-template-columns: 1fr; } }

.grid { display: grid; gap: var(--space-6); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1024px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px)  { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: 0.85rem 1.25rem;
  font-size: var(--fs-14); font-weight: 600; letter-spacing: 0.01em;
  border-radius: var(--r-md); border: 1.5px solid transparent;
  transition: background var(--t-fast) var(--ease-out), color var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
  white-space: nowrap;
}
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-600); transform: translateY(-1px); }
.btn--solid { background: var(--brand-800); color: #fff; }
.btn--solid:hover { background: var(--brand-700); transform: translateY(-1px); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--border-strong); }
.btn--ghost:hover { border-color: var(--brand-800); color: var(--brand-800); }
.btn--ghost-inverse { background: transparent; color: #fff; border-color: rgba(255,255,255,0.4); }
.btn--ghost-inverse:hover { background: rgba(255,255,255,0.08); border-color: #fff; }
.btn--lg { padding: 1.05rem 1.6rem; font-size: var(--fs-16); }
.btn--sm { padding: 0.55rem 0.9rem; font-size: var(--fs-12); }
.btn .arrow { width: 16px; height: 16px; }

/* ---------- Top nav ---------- */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.92); backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
html[data-theme="dark"] .topbar { background: rgba(11, 18, 30, 0.85); }

.nav { height: var(--nav-h); display: flex; align-items: center; justify-content: space-between; gap: var(--space-6); }
.nav-brand { display: flex; align-items: center; gap: var(--space-3); font-weight: 700; color: var(--brand-800); letter-spacing: -0.01em; }
html[data-theme="dark"] .nav-brand { color: #fff; }
.nav-brand-logo {
  width: 48px; height: 48px; display: grid; place-items: center;
  flex: none; overflow: hidden;
}
.nav-brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.nav-brand-name { font-size: var(--fs-14); line-height: 1.15; display: grid; gap: 2px; }
.nav-brand-name b { font-size: var(--fs-16); }
.nav-brand-name span { color: var(--ink-muted); font-weight: 500; font-size: var(--fs-12); letter-spacing: 0.04em; text-transform: uppercase; }

.nav-links { display: flex; align-items: center; gap: var(--space-1); list-style: none; padding: 0; margin: 0; }
.nav-links a {
  display: inline-flex; padding: 0.5rem 0.9rem; font-size: var(--fs-14); font-weight: 500;
  color: var(--steel-700); border-radius: var(--r-sm);
  transition: color var(--t-fast), background var(--t-fast);
}
html[data-theme="dark"] .nav-links a { color: var(--steel-300); }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--brand-800); background: var(--brand-50); }
html[data-theme="dark"] .nav-links a:hover,
html[data-theme="dark"] .nav-links a[aria-current="page"] { color: #fff; background: rgba(255,255,255,0.06); }

.nav-actions { display: flex; align-items: center; gap: var(--space-3); }
.lang-switch {
  position: relative;
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: 0.55rem 0.85rem; font-size: var(--fs-13, 13px);
  border: 1px solid var(--border); border-radius: var(--r-md);
  color: var(--ink); background: transparent;
}
.lang-switch:hover { border-color: var(--brand-500); }
.lang-switch svg { width: 16px; height: 16px; opacity: 0.7; }
.lang-current { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.lang-current-flag,
.lang-current-code { display: none; }
.lang-flag {
  width: 22px;
  height: 16px;
  display: inline-block;
  flex: none;
  overflow: hidden;
  border-radius: 2px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.16);
  background: var(--steel-200);
}
.lang-flag--en {
  background:
    linear-gradient(32deg, transparent 42%, #fff 42% 48%, #c8102e 48% 54%, #fff 54% 60%, transparent 60%),
    linear-gradient(-32deg, transparent 42%, #fff 42% 48%, #c8102e 48% 54%, #fff 54% 60%, transparent 60%),
    linear-gradient(90deg, transparent 42%, #fff 42% 58%, transparent 58%),
    linear-gradient(0deg, transparent 38%, #fff 38% 62%, transparent 62%),
    linear-gradient(90deg, transparent 45%, #c8102e 45% 55%, transparent 55%),
    linear-gradient(0deg, transparent 43%, #c8102e 43% 57%, transparent 57%),
    #012169;
}
.lang-flag--zh {
  background:
    radial-gradient(circle at 30% 34%, #ffde00 0 15%, transparent 16%),
    radial-gradient(circle at 48% 20%, #ffde00 0 5%, transparent 6%),
    radial-gradient(circle at 55% 34%, #ffde00 0 5%, transparent 6%),
    #de2910;
}
.lang-flag--ru { background: linear-gradient(#fff 0 33%, #1f57a4 33% 66%, #d52b1e 66%); }
.lang-flag--es { background: linear-gradient(#aa151b 0 25%, #f1bf00 25% 75%, #aa151b 75%); }
.lang-flag--ar {
  background:
    radial-gradient(circle at 50% 50%, transparent 0 22%, #fff 23% 29%, transparent 30%),
    #006c35;
}
.lang-menu {
  position: absolute; top: calc(100% + 6px); inset-inline-end: 0;
  min-width: 180px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: 4px; display: none; z-index: 110;
}
.lang-menu.is-open { display: block; }
.lang-menu button,
.lang-menu a[role="option"] {
  display: flex; width: 100%; align-items: center; gap: var(--space-3);
  padding: 0.55rem 0.7rem; font-size: var(--fs-14);
  background: transparent; border: 0; border-radius: var(--r-sm); color: var(--ink); text-align: start;
  text-decoration: none; box-sizing: border-box;
}
.lang-menu button:hover,
.lang-menu a[role="option"]:hover { background: var(--surface-alt); }
.lang-menu .active-mark { margin-inline-start: auto; color: var(--accent); }

.nav-mobile-toggle {
  display: none;
  width: 40px; height: 40px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: transparent; align-items: center; justify-content: center;
}
.nav-mobile-toggle span,
.nav-mobile-toggle span::before,
.nav-mobile-toggle span::after {
  content: ""; display: block; width: 18px; height: 1.5px; background: var(--ink); position: relative;
}
.nav-mobile-toggle span::before { position: absolute; top: -6px; left: 0; right: 0; }
.nav-mobile-toggle span::after  { position: absolute; top:  6px; left: 0; right: 0; }

@media (max-width: 980px) {
  .nav-links, .nav-actions .btn { display: none; }
  .nav-mobile-toggle { display: inline-flex; }
}

@media (max-width: 760px) {
  .container { padding-inline: var(--space-5); }
  .nav { gap: var(--space-3); }
  .nav-brand { min-width: 0; gap: var(--space-2); }
  .nav-brand-logo { width: 44px; height: 44px; }
  .nav-brand-name { min-width: 0; }
  .nav-brand-name b { font-size: var(--fs-14); white-space: nowrap; }
  .nav-brand-name span { display: none; }
  .nav-actions { gap: var(--space-2); flex: none; }
  .lang-switch {
    min-width: 72px;
    height: 44px;
    padding: 0 0.65rem;
    justify-content: center;
  }
  .lang-switch > svg:first-child { display: none; }
  .lang-current-name { display: none; }
  .lang-current-flag,
  .lang-current-code { display: inline-flex; }
  .lang-current-code { font-weight: 700; letter-spacing: 0.04em; }
  .lang-menu { inset-inline-end: -52px; }
  .nav-mobile-toggle { width: 44px; height: 44px; flex: none; }
}

@media (max-width: 420px) {
  .container { padding-inline: var(--space-4); }
  .nav-brand-logo { width: 40px; height: 40px; }
  .nav-brand-name b { font-size: var(--fs-13, 13px); }
}

/* Mobile drawer */
.drawer { position: fixed; inset: 0; z-index: 200; pointer-events: none; }
.drawer-scrim { position: absolute; inset: 0; background: rgba(6, 27, 58, 0.5); opacity: 0; transition: opacity var(--t-base); }
.drawer-panel {
  position: absolute; top: 0; bottom: 0; inset-inline-end: 0;
  width: min(360px, 88vw); background: var(--surface);
  transform: translateX(100%); transition: transform var(--t-base) var(--ease-out);
  padding: var(--space-6); display: grid; gap: var(--space-4); align-content: start;
  overflow-y: auto;
}
html[dir="rtl"] .drawer-panel { transform: translateX(-100%); }
.drawer.is-open { pointer-events: auto; }
.drawer.is-open .drawer-scrim { opacity: 1; }
.drawer.is-open .drawer-panel { transform: translateX(0); }
.drawer-close {
  align-self: flex-end;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--ink);
  display: grid;
  place-items: center;
  line-height: 1;
}
.drawer-close svg { width: 16px; height: 16px; }
.drawer-links { display: grid; gap: 2px; list-style: none; padding: 0; margin: var(--space-4) 0 0; }
.drawer-links a { padding: 0.85rem 0.5rem; border-bottom: 1px solid var(--border); font-size: var(--fs-18); font-weight: 600; color: var(--ink); display: flex; justify-content: space-between; align-items: center; }
.drawer-cta { margin-top: var(--space-6); display: grid; gap: var(--space-3); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform var(--t-base) var(--ease-out), box-shadow var(--t-base), border-color var(--t-base);
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.card-media { aspect-ratio: 4/3; background: var(--steel-100); overflow: hidden; position: relative; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--t-slow) var(--ease-out); }
.card:hover .card-media img { transform: scale(1.04); }
.card-body { padding: var(--space-5); display: grid; gap: var(--space-2); }
.card-tag { font-size: var(--fs-12); color: var(--accent); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.card-title { font-size: var(--fs-18); font-weight: 700; color: var(--ink); }
.card-meta { font-size: var(--fs-14); color: var(--ink-muted); }

/* ---------- Forms ---------- */
.field { display: grid; gap: var(--space-2); }
.field label { font-size: var(--fs-13, 13px); font-weight: 600; color: var(--ink); letter-spacing: 0.01em; }
.field label .req { color: var(--accent); margin-inline-start: 2px; }
.input, .select, .textarea {
  appearance: none; width: 100%;
  padding: 0.85rem 1rem; font-size: var(--fs-16); line-height: 1.4;
  background: var(--surface); color: var(--ink);
  border: 1.5px solid var(--border); border-radius: var(--r-md);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  font-family: inherit;
}
.input:focus, .select:focus, .textarea:focus {
  outline: 0; border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent) 18%, transparent);
}
.input.is-invalid, .select.is-invalid, .textarea.is-invalid {
  border-color: var(--status-danger);
}
.textarea { resize: vertical; min-height: 140px; }
.field-error { font-size: var(--fs-12); color: var(--status-danger); min-height: 1.2em; }
.select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'><path d='M1 1.5L6 6.5L11 1.5' stroke='%2364748B' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-inline-end: 2.5rem;
}
html[dir="rtl"] .select { background-position: left 1rem center; }

.toast { padding: var(--space-4); border-radius: var(--r-md); font-size: var(--fs-14); display: none; }
.toast--success { background: color-mix(in oklab, var(--status-success) 14%, var(--surface)); color: var(--status-success); border: 1px solid color-mix(in oklab, var(--status-success) 35%, transparent); }
.toast--error   { background: color-mix(in oklab, var(--status-danger) 12%, var(--surface)); color: var(--status-danger); border: 1px solid color-mix(in oklab, var(--status-danger) 35%, transparent); }
.toast.is-visible { display: block; }

/* ---------- Footer ---------- */
.footer { background: var(--brand-900); color: #fff; padding: var(--space-16) 0 var(--space-6); }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1.2fr; gap: var(--space-10); }
@media (max-width: 980px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .footer-grid { grid-template-columns: 1fr; } }
.footer h5 { color: #fff; font-size: var(--fs-12); letter-spacing: 0.14em; text-transform: uppercase; margin-bottom: var(--space-4); font-weight: 700; }
.footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-2); font-size: var(--fs-14); }
.footer a,
.footer li,
.footer .nav-brand,
.footer .nav-brand-name b,
.footer .nav-brand-name span { color: #fff; }
.footer a:hover { color: #fff; }
.footer .nav-brand-logo { width: 76px; height: 76px; }
.footer-brand p { font-size: var(--fs-14); line-height: var(--lh-loose); color: #fff; max-width: 36ch; }
.footer-social { display: flex; gap: var(--space-2); margin-top: var(--space-4); }
.footer-social a {
  width: 36px; height: 36px; border-radius: var(--r-md); display: grid; place-items: center;
  border: 1px solid rgba(255,255,255,0.28); color: #fff;
}
.footer-social a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.footer-bottom {
  margin-top: var(--space-12); padding-top: var(--space-6);
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--space-3);
  font-size: var(--fs-12); color: #fff;
}

/* ---------- Utility ---------- */
.divider { height: 1px; background: var(--border); border: 0; margin: 0; }
.row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.chip {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: 0.3rem 0.7rem; border-radius: var(--r-pill);
  background: var(--brand-50); color: var(--brand-800);
  font-size: var(--fs-12); font-weight: 600; letter-spacing: 0.02em;
}
.chip--ghost { background: transparent; border: 1px solid var(--border); color: var(--ink-muted); }

/* ---------- Reveal ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out); }
.reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  * { animation: none !important; transition: none !important; }
}

/* ---------- Floating CTA (WhatsApp) ---------- */
.fab {
  position: fixed; bottom: var(--space-6); inset-inline-end: var(--space-6);
  width: 56px; height: 56px; border-radius: 50%;
  background: #25D366; color: #fff;
  display: grid; place-items: center; box-shadow: var(--shadow-lg); z-index: 90;
  border: 0;
}
.fab:hover { transform: scale(1.05); }
.fab svg { width: 26px; height: 26px; }

/* ---------- Tweaks panel ---------- */
.tweaks {
  position: fixed; bottom: var(--space-6); inset-inline-start: var(--space-6);
  z-index: 90; font-size: var(--fs-12);
}
.tweaks-btn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  background: var(--brand-900); color: #fff; padding: 0.55rem 0.85rem;
  border: 0; border-radius: var(--r-pill); box-shadow: var(--shadow-lg);
  font-weight: 600;
}
.tweaks-panel {
  position: absolute; bottom: calc(100% + 8px); inset-inline-start: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: var(--space-4); width: 260px; box-shadow: var(--shadow-lg);
  display: none;
}
.tweaks.is-open .tweaks-panel { display: grid; gap: var(--space-3); }
.tweaks-row { display: grid; gap: var(--space-2); }
.tweaks-row > label { font-size: var(--fs-12); color: var(--ink-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.tweaks-row .opts { display: flex; gap: 6px; }
.tweaks-row .opts button {
  flex: 1; padding: 6px 0; font-size: var(--fs-12); font-weight: 600;
  border: 1px solid var(--border); background: transparent; color: var(--ink); border-radius: var(--r-sm);
}
.tweaks-row .opts button[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Pagination (shared: products / cases / news) ───────────────── */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: var(--space-2); flex-wrap: wrap;
  margin-top: var(--space-12); padding-top: var(--space-8);
  border-top: 1px solid var(--border);
}
.pagination .page-list { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pagination a, .pagination span.page-num {
  --sz: 40px;
  min-width: var(--sz); height: var(--sz); padding: 0 0.7rem;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: var(--fs-14); font-weight: 600; line-height: 1;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  text-decoration: none; cursor: pointer; transition: all var(--t-fast);
}
.pagination a:hover { border-color: var(--brand-800); color: var(--brand-800); }
.pagination .page-num[aria-current="page"] {
  background: var(--brand-900); border-color: var(--brand-900); color: #fff; cursor: default;
}
.pagination .page-edge { gap: 6px; font-family: var(--font-sans, inherit); }
.pagination .page-edge svg { width: 15px; height: 15px; }
/* mirror prev/next chevrons under RTL */
[dir="rtl"] .pagination .page-edge svg { transform: scaleX(-1); }
.pagination .page-edge[aria-disabled="true"] {
  opacity: 0.4; pointer-events: none; cursor: default;
}
.pagination .page-gap {
  min-width: auto; border: 0; background: transparent; color: var(--ink-muted);
  padding: 0 2px; letter-spacing: 0.1em;
}
.pagination .page-meta {
  width: 100%; text-align: center; margin-top: var(--space-3);
  font-size: var(--fs-12); color: var(--ink-muted);
  font-family: var(--font-mono, ui-monospace, monospace); letter-spacing: 0.04em;
}
@media (max-width: 560px) {
  .pagination .page-edge span { display: none; }
}

/* 隐藏页面悬浮组件：右下 WhatsApp 联系按钮(.fab)、左下主题微调面板(.tweaks)、
   平台兜底语言切换器(.aiw-lang-fab)。顶部导航已自带语言切换、页脚仍有 WhatsApp 联系，故无功能损失。 */
.fab,
.tweaks,
.aiw-lang-fab { display: none !important; }
