/* ─────────────────────────────────────────────────────────────
   CMEX.ai — base.css
   Foundation: font, reset, theme variables (light/dark), typography.
   Theme variables mirror getTheme() in data/_disign/hybrid.jsx,
   with accent overridden to #FF6B35 (orange).
   ───────────────────────────────────────────────────────────── */

/* Manrope — self-hosted (latin + cyrillic, woff2). Файлы: data/www/cmex.net/fonts/manrope/.
   Никаких внешних запросов к Google. font-display:swap — fallback пока грузится. */
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../../fonts/manrope/manrope-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../../fonts/manrope/manrope-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../../fonts/manrope/manrope-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../../fonts/manrope/manrope-700.woff2') format('woff2');
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('../../fonts/manrope/manrope-800.woff2') format('woff2');
}

/* ── Reset ───────────────────────────────────────────────────── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

img,
svg,
video,
canvas,
audio,
iframe,
embed,
object {
  display: block;
  max-width: 100%;
}

/* HTML5 block elements — full width, normalized display
   (avoids stale UA defaults shrinking <main>/<section> on some browsers) */
main,
header,
footer,
section,
article,
nav,
aside {
  display: block;
  width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

button {
  cursor: pointer;
}

ul,
ol {
  list-style: none;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* ── Theme variables: light (default) ────────────────────────── */
:root,
:root[data-theme="light"] {
  --bg: #fff;
  --bg-elevated: #F4F6FA;
  --text: #0B1437;
  --text-muted: #6B7280;
  --text-dim: #9CA3AF;
  --card: #ECEFF5;
  --card-solid: #DDE2EB;
  --chip-bg: #fff;
  --chip-border: #E5E8EF;
  --chip-active-bg: #0B1437;
  --chip-active-fg: #fff;
  --divider: #ECEFF5;
  --icon-stroke: #0B1437;
  --stripe: rgba(11, 20, 55, 0.035);
  --surface-on-image: rgba(255, 255, 255, 0.92);
  --accent: #FF6B35;
  --accent-soft: rgba(255, 107, 53, 0.12);
  --navy: #0B1437;
  --cta-bg: #0B1437;
  --cta-fg: #fff;
  --tabbar: rgba(255, 255, 255, 0.98);
  --tabbar-border: rgba(0, 0, 0, 0.08);
  --tabbar-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
  --hero-from: rgba(11, 20, 55, 0.95);
  --hero-via: rgba(11, 20, 55, 0.35);
}

/* ── Theme variables: dark ───────────────────────────────────── */
:root[data-theme="dark"] {
  --bg: #070E26;
  --bg-elevated: #0E1738;
  --text: #fff;
  --text-muted: rgba(255, 255, 255, 0.55);
  --text-dim: rgba(255, 255, 255, 0.35);
  --card: #1A2547;
  --card-solid: #22305C;
  --chip-bg: transparent;
  --chip-border: rgba(255, 255, 255, 0.16);
  --chip-active-bg: #FF6B35;
  --chip-active-fg: #fff;
  --divider: rgba(255, 255, 255, 0.06);
  --icon-stroke: #fff;
  --stripe: rgba(255, 255, 255, 0.04);
  --surface-on-image: rgba(0, 0, 0, 0.55);
  --accent: #FF6B35;
  --accent-soft: rgba(255, 107, 53, 0.14);
  --navy: #0B1437;
  --cta-bg: #fff;
  --cta-fg: #0B1437;
  --tabbar: rgba(7, 14, 38, 0.98);
  --tabbar-border: rgba(255, 255, 255, 0.1);
  --tabbar-shadow: 0 -2px 12px rgba(0, 0, 0, 0.4);
  --hero-from: rgba(7, 14, 38, 0.95);
  --hero-via: rgba(7, 14, 38, 0.4);
}

/* ── Body ────────────────────────────────────────────────────── */
body {
  font-family: 'Manrope', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 400;
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
  /* Универсальный sticky footer: страница ≥ высоты экрана, контент тянется,
     футер прижат к низу при коротком контенте — без магических чисел.
     Фикс-оверлеи (.m-tabbar/.m-menu-sheet) — position:fixed, на flex не влияют. */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body > main { flex: 1 0 auto; }
body > footer { flex-shrink: 0; }

/* ── Smooth theme transition ─────────────────────────────────── */
html,
body,
* {
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

/* ── Typography ──────────────────────────────────────────────── */
h1 {
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.02;
}

h2 {
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

h3,
h4,
h5,
h6 {
  font-weight: 700;
  letter-spacing: -0.01em;
}

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