/* основа */

/* Переход между страницами без JS: шапка и подвал меняются сразу, содержимое (#main) проявляется за 150 мс.
   Старый снимок не показывается: со старой прокрученной страницы он лёг бы на новую со сдвигом.
   Если в системе включено «уменьшить движение», перехода нет. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }
}

:root {
  view-transition-name: none;
}

/* атрибут hidden сильнее display у классов (.btn — inline-flex) */
[hidden] {
  display: none !important;
}

#main {
  view-transition-name: content;
}

::view-transition-group(content) {
  animation: none;
}

::view-transition-old(content) {
  display: none;
}

::view-transition-new(content) {
  animation: 150ms cubic-bezier(0.4, 0, 1, 1) both page-in;
}

@keyframes page-in {
  from {
    opacity: 0;
  }
}

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

html {
  /* ссылка на якорь останавливается ниже плавающей шапки */
  scroll-padding-top: 112px;
  scrollbar-color: var(--color-muted) var(--color-paper);

  @media (prefers-reduced-motion: no-preference) {
    scroll-behavior: smooth;
  }
}

html, body {
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--color-paper);
  color: var(--color-ink-2);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  caret-color: var(--color-accent);
}

::selection {
  background: color-mix(in oklab, var(--color-accent) 22%, transparent);
  color: var(--color-ink);
}

:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

h1, h2, h3, h4, h5, h6, p, blockquote, figure, dl, dd, ul, ol, table, fieldset {
  margin: 0;
}

h1, h2, h3, .h1, .h2, .h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: var(--tracking-display);
  color: var(--color-ink);
  font-synthesis: none;
  overflow-wrap: break-word;
  text-wrap: balance;
}

h1, .h1 {
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1.1;
}

h2, .h2 {
  font-size: clamp(1.5rem, 1vw + 1.1rem, 2rem);
  line-height: 1.15;
}

/* h3 — подзаголовок текста: шрифт текста, без сжатия букв */
h3, .h3 {
  font-family: var(--font-body);
  font-size: var(--text-xl);
  line-height: 1.3;
  letter-spacing: 0;
}

h4, h5, h6 {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--color-ink);
}

p {
  text-wrap: pretty;
}

a {
  color: var(--color-ink);
  text-decoration-color: color-mix(in oklab, currentColor 40%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

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

img, video {
  max-width: 100%;
  height: auto;
}

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

button, input, select, textarea {
  font: inherit;
}

.color-red {
  color: var(--color-accent);
}

.clean, .clear {
  clear: both;
}

.img-right {
  float: right;
  margin: 0 0 var(--space-md) var(--space-lg);
  border-radius: var(--radius-card);

  @media (width < 960px) {
    max-width: 35%;
    margin: 0 0 var(--space-md) var(--space-sm);
  }
}

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* видимость по ширине: d — экран от 960px, m — уже, v — телефон до 510px */

.visible-m, .visible-h, .visible-v, .hidden-d {
  @media (width >= 960px) {
    display: none !important;
  }
}

.visible-d, .visible-v, .hidden-h {
  @media (width < 960px) {
    display: none !important;
  }
}

.visible-v, .hidden-h {
  @media (width <= 510px) {
    display: block !important;
  }
}

.visible-d, .visible-h, .hidden-v {
  @media (width <= 510px) {
    display: none !important;
  }
}

/* бывшие blazy-картинки: у загруженной .b-lazy старый CSS задавал display: block */
.lazy-block {
  display: block;
}

@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;
  }
}
