/* ============================================================
   БАЗА — общие правила. Шрифт берётся только из переменной --font
   ============================================================ */

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

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

body {
  margin: 0;
  background: var(--surface-2);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--t-base);
  line-height: var(--lh-base);
  font-weight: var(--w-regular);
  letter-spacing: var(--font-tracking-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-family: var(--font);
  font-weight: var(--w-medium);
  letter-spacing: var(--font-tracking-head);
}

h1 { font-size: var(--t-h1); line-height: var(--lh-h1); }
h2 { font-size: var(--t-h2); line-height: var(--lh-h2); }
h3 { font-size: var(--t-h3); line-height: var(--lh-h3); }
h4 { font-size: var(--t-h4); line-height: var(--lh-h4); }

p { margin: 0; }
img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; letter-spacing: inherit; color: inherit; }
button { margin: 0; padding: 0; border: 0; background: none; cursor: pointer; text-align: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }

/* --- контейнер и сетка --- */
.container {
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: var(--page-pad);
}

.grid {
  display: grid;
  grid-template-columns: repeat(var(--grid-cols), minmax(0, 1fr));
  gap: var(--grid-gap);
}

/* --- кнопки --- */
.btn {
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 28px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font-size: var(--t-sm);
  font-weight: var(--w-semibold);
  cursor: pointer;
  transition: background-color .2s, color .2s, border-color .2s;
}
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-press); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--ink-3); }
.btn--light { background: #fff; color: var(--ink); }

/* --- поля ввода --- */
.field {
  width: 100%;
  min-height: 48px;
  padding: 12px 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  outline: none;
  transition: border-color .2s;
}
.field::placeholder { color: var(--ink-3); }
.field:focus { border-color: var(--brand); }

/* --- карточка --- */
.card {
  background: var(--surface);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
}

/* --- служебное --- */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* Длина строк отличается по языкам: узбекский длиннее русского,
   английский короче. Ничего не обрезаем — переносим. */
[lang="uz"] .btn, [lang="en"] .btn { white-space: nowrap; }
.nowrap-safe { overflow-wrap: anywhere; }

/* Поле телефона с выбором страны (js/ui.js, window.sarkorPhone) */
.phone { position: relative; display: block; min-width: 0; }
.phone > input[type="tel"] { width: 100%; padding-left: 62px !important; }
.phone__flag { position: absolute; left: 6px; top: 50%; z-index: 1; display: flex; align-items: center; gap: 5px; height: calc(100% - 12px); max-height: 40px; padding: 0 7px; border: 0; border-radius: 10px; background: rgba(44, 48, 56, .07); color: #2C3038; cursor: pointer; transform: translateY(-50%); }
.phone__flag:hover, .phone__flag:focus-visible { background: rgba(239, 127, 26, .18); }
.phone__emoji { font-size: 18px; line-height: 1; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.phone__caret { width: 7px; height: 5px; background: currentColor; clip-path: polygon(0 0, 100% 0, 50% 100%); opacity: .6; }
.phone__pop { position: absolute; left: 0; top: calc(100% + 6px); z-index: 30; width: max(100%, 300px); max-width: calc(100vw - 40px); padding: 10px; border-radius: 15px; background: #fff; box-shadow: 0 16px 40px rgba(0, 0, 0, .35); color: #2C3038; text-align: left; }
.phone .phone__pop .phone__search { display: block; width: 100%; height: 40px; min-height: 0; margin: 0; padding: 0 12px; border: 1px solid #DDE2E8; border-radius: 10px; background: #fff; color: #2C3038; font: inherit; font-size: 14px; }
.phone .phone__pop .phone__search:focus { outline: none; border-color: var(--brand); }
.phone__list { max-height: 240px; margin: 8px 0 0; padding: 0; overflow-y: auto; list-style: none; }
.phone__list button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: inherit; font: inherit; font-size: 14px; line-height: 20px; text-align: left; cursor: pointer; }
.phone__list button:hover, .phone__list button:focus-visible, .phone__list button[aria-selected="true"] { background: rgba(239, 127, 26, .14); }
.phone__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phone__code { color: #6B7280; }
.phone__none { padding: 10px; font-size: 14px; color: #6B7280; }
