/* ═══════════════════════════════════════════════════════════════════════
   base.css — reset, o'lcham tokenlari, tipografika

   Ranglar bu yerda EMAS — ular `theme.css` da (yorug'/qorong'i va
   Telegram mavzusi bir joyda turishi uchun).
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Tokenlar: o'lcham, masofa, shrift ─────────────────────────────────── */

:root {
  /* Tizim shriftlari — yuklab olish yo'q, darhol chiziladi */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;

  /* Barmoq uchun eng kichik o'lcham (foydalanish qulayligi talabi) */
  --tap: 44px;

  --text-xs: 12px;
  --text-sm: 14px;
  --text-md: 16px;   /* iOS da 16px dan kichik maydon sahifani kattalashtiradi */
  --text-lg: 20px;
  --text-xl: 26px;

  --shell-max: 560px;

  /* Klaviatura ochilganda pastki tugma yopilib qolmasligi uchun.
     `tg.js` uni `viewportStableHeight` yoki `visualViewport` dan yangilaydi. */
  --viewport: 100dvh;
  --safe-bottom: 0px;
  --safe-top: 0px;
}

/* ── Reset ─────────────────────────────────────────────────────────────── */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--text-md);
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  /* Sahifa gorizontal siljimasin */
  overflow-x: hidden;
}

h1, h2, h3, h4, p, figure, blockquote, dl, dd {
  margin: 0;
}

ul, ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

img, svg {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  margin: 0;
}

button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

table {
  border-collapse: collapse;
  width: 100%;
}

[hidden] {
  display: none !important;
}

/* ── Tipografika ───────────────────────────────────────────────────────── */

.h1 {
  font-size: var(--text-xl);
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.h2 {
  font-size: var(--text-lg);
  line-height: 1.3;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.h3 {
  font-size: var(--text-md);
  font-weight: 650;
}

.dim {
  color: var(--text-dim);
}

.small {
  font-size: var(--text-sm);
}

.tiny {
  font-size: var(--text-xs);
}

.center {
  text-align: center;
}

.right {
  text-align: right;
}

/* Summalar: raqamlar ustma-ust tekis tursin */
.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.positive { color: var(--positive); }
.negative { color: var(--negative); }

/* Ekranda ko'rinmaydi, lekin screen reader o'qiydi */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ── Fokus ─────────────────────────────────────────────────────────────── */

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ── Harakat ───────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
