/* ============================================================
   База: сброс браузерных умолчаний и типографика.
   Компоненты — в main.css, значения — в tokens.css.
   ============================================================ */

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

html {
   font-family: var(--font);
   -webkit-text-size-adjust: 100%;
   scroll-behavior: smooth;
}

body {
   margin: 0;
   padding: 0;
   min-height: 100%;
   background-color: var(--bg);
   color: var(--ink-2);
   font-size: var(--fs-body);
   line-height: var(--lh-body);
   -webkit-font-smoothing: antialiased;
   text-rendering: optimizeLegibility;
   /* Ни один блок не должен уезжать за край экрана.
      Именно clip, а не hidden: hidden делает body контейнером прокрутки
      и ломает position: sticky у шапки. */
   overflow-x: clip;
}

section {
   width: 100%;
   display: flex;
   justify-content: center;
}

/* --- Заголовки: настоящая шкала вместо одинаковых 32px --- */
h1, h2, h3, h4, h5, h6 {
   margin: 0;
   color: var(--ink);
   font-weight: 700;
   line-height: var(--lh-head);
   text-wrap: balance;
}
h1 { font-size: var(--fs-h1); letter-spacing: -.02em; }
h2 { font-size: var(--fs-h2); letter-spacing: -.015em; }
h3 { font-size: var(--fs-h3); letter-spacing: -.01em; }
h4 { font-size: 20px; }
h5 { font-size: 18px; }
h6 { font-size: 17px; }

p {
   margin: 0;
   color: var(--ink-2);
   font-size: var(--fs-body);
   line-height: var(--lh-body);
}

ul li, ol li {
   font-size: var(--fs-body);
   line-height: var(--lh-body);
}

a {
   color: inherit;
   font-size: inherit;
   text-decoration: none;
   transition: color var(--t-fast);
}

img {
   max-width: 100%;
   height: auto;
   vertical-align: middle;
}

hr {
   margin: var(--sp-8) 0;
   width: 100%;
   height: 0;
   padding: 0;
   border: none;
   border-top: 1px solid var(--line);
}

header {
   display: flex;
   flex-direction: column;
}

/* --- Поля ввода --- */
input, button, textarea, select {
   font-family: inherit;
   font-size: var(--fs-body);
   color: inherit;
}

input, textarea, select {
   width: 100%;
   margin: 0;
   padding: 12px 14px;
   background: var(--bg-soft);
   border: 1px solid var(--line);
   border-radius: var(--r-sm);
   color: var(--ink);
   line-height: 1.4;
   resize: vertical;
   transition: border-color var(--t-fast), box-shadow var(--t-fast), background-color var(--t-fast);
   /* Раньше здесь стоял user-select: none — текст в поле нельзя было выделить */
}

input::placeholder, textarea::placeholder {
   color: var(--muted-2);
}

input:hover, textarea:hover, select:hover {
   border-color: var(--brand-200);
}

input:focus, textarea:focus, select:focus {
   background: var(--bg);
   border-color: var(--brand-500);
   box-shadow: 0 0 0 3px var(--brand-100);
   outline: none;
}

input:disabled, textarea:disabled, select:disabled {
   background: var(--line-2);
   color: var(--muted-2);
   cursor: not-allowed;
}

select {
   appearance: none;
   padding-right: 40px;
   background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='8' viewBox='0 0 14 8'%3E%3Cpath d='M1 1l6 6 6-6' stroke='%236E6880' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
   background-repeat: no-repeat;
   background-position: right 14px center;
   cursor: pointer;
}

textarea {
   min-height: 140px;
}

label {
   display: block;
   margin-bottom: var(--sp-2);
   color: var(--ink);
   font-size: var(--fs-sm);
   font-weight: 600;
}

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

input[type="file"] {
   padding: 10px;
   cursor: pointer;
}

input[type="checkbox"], input[type="radio"] {
   width: auto;
   accent-color: var(--brand-500);
   cursor: pointer;
}

/* Кнопки-сабмиты выглядят как .btn — стиль задан один раз в main.css */
input[type="submit"], button[type="submit"] {
   width: auto;
}

/* --- Фокус: видимая рамка для клавиатуры, без рамки для мыши --- */
:focus-visible {
   outline: none;
   box-shadow: var(--focus);
   border-radius: var(--r-sm);
}

/* Якоря не прячутся под залипающую шапку */
[id] {
   scroll-margin-top: calc(var(--header-h) + var(--sp-6));
}

/* Ссылка «к содержимому» для клавиатуры и скринридеров */
.skip-link {
   position: absolute;
   left: -9999px;
   top: 0;
   z-index: 200;
   padding: 12px 20px;
   background: var(--brand-900);
   color: #fff;
   border-radius: 0 0 var(--r-md) 0;
   font-weight: 600;
}
.skip-link:focus {
   left: 0;
}

.visually-hidden {
   position: absolute;
   width: 1px;
   height: 1px;
   margin: -1px;
   padding: 0;
   overflow: hidden;
   clip: rect(0 0 0 0);
   white-space: nowrap;
   border: 0;
}
