/* ==========================================================================
   CodeMist — Base / Reset
   ========================================================================== */

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

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--f-body);
  font-size: var(--fs-base);
  line-height: 1.55;
  overflow-x: hidden;          /* страхуемся от горизонтальных переполнений из-за дыма/свечений */
  -webkit-font-smoothing: antialiased;
}

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

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

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

h1, h2, h3, h4 {
  font-family: var(--f-display);
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--c-text);
}

a { color: inherit; text-decoration: none; }

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

button { cursor: pointer; }

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

fieldset { border: none; margin: 0; padding: 0; }

/* фокус — доступность, обязателен для клавиатурной навигации */
:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

::selection {
  background: rgba(var(--c-accent-rgb), .32);
  color: #fff;
}

/* тонкий скроллбар в общей палитре */
* { scrollbar-width: thin; scrollbar-color: rgba(var(--c-accent-rgb), .35) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: rgba(var(--c-accent-rgb), .3);
  border-radius: var(--radius-pill);
}
*::-webkit-scrollbar-thumb:hover { background: rgba(var(--c-accent-rgb), .5); }

/* ---- корневой каркас страницы: шапка / контент / нижнее меню ---- */
.page {
  position: relative;
  z-index: var(--z-content);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.page__main {
  flex: 1 1 auto;
  width: 100%;
  padding-top: var(--header-h);
  padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + var(--sp-6));
  min-width: 0; /* защита от переполнения флекс-детьми */
}

.container {
  width: 100%;
  max-width: 1080px;
  margin-inline: auto;
  padding-inline: var(--sp-5);
}

@media (max-width: 560px) {
  .container { padding-inline: var(--sp-4); }
}

/* утилита переноса длинных строк кода/ссылок — важно против overflow */
.text-wrap-safe {
  overflow-wrap: anywhere;
  word-break: break-word;
}

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