/* ============================================================
   Сброс и базовая типографика

   Заменяет собой Bootstrap Reboot. Всё, что раньше приезжало с CDN ради
   десятка правил, теперь здесь и опирается на токены.
   ============================================================ */

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

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
    /* clip, а не hidden: hidden делает элемент контейнером прокрутки и
       ломает position: sticky у шапки, а clip просто обрезает вынос.
       Первая строка — запас для Safari младше 16 */
    overflow-x: hidden;
    overflow-x: clip;
}

body {
    margin: 0;
    min-height: 100dvh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Горизонтальный скролл на телефоне ломает вертикальный: страница
       начинает ездить вбок при попытке пролистать вниз */
    overflow-x: hidden;
    overflow-x: clip;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-weight: var(--weight-semibold);
    line-height: var(--leading-tight);
    letter-spacing: -0.01em;
    color: var(--text);
}

h1 { font-size: var(--text-xl); }
h2 { font-size: var(--text-lg); }
h3 { font-size: var(--text-md); }
h4 { font-size: var(--text-base); }
h5, h6 { font-size: var(--text-sm); }

p {
    margin: 0;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease);
}

a:hover {
    color: var(--accent-hover);
}

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

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

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

button {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

code, pre, .mono {
    font-family: var(--font-mono);
    font-size: 0.92em;
}

hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: var(--space-4) 0;
}

/* Видимый фокус только с клавиатуры: обводка вокруг только что нажатой
   мышью кнопки выглядит как ошибка интерфейса */
:focus {
    outline: none;
}

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

::selection {
    background: var(--accent-soft);
    color: var(--text);
}

/* Полосы прокрутки: тонкие и в цвет темы. Дефолтная белая полоса в тёмной
   теме — самая заметная деталь на экране */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================================
   Текстовые роли
   ============================================================ */

.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-info { color: var(--info); }

.text-2xs { font-size: var(--text-2xs); }
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-md { font-size: var(--text-md); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }

.font-medium { font-weight: var(--weight-medium); }
.font-semibold { font-weight: var(--weight-semibold); }
.font-bold { font-weight: var(--weight-bold); }

.numeric {
    font-variant-numeric: var(--numeric);
}

/* Обрезка длинных имён ботов и username в узких колонках */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.nowrap { white-space: nowrap; }

.uppercase {
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* Подпись раздела над группой карточек */
.eyebrow {
    font-size: var(--text-2xs);
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

/* Доступно скринридеру, невидимо глазами */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
