/* ============================================
   KVATASK SITE — BASE
   Reset, body, container, типографика, focus
   ============================================ */

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

html {
  scroll-behavior: smooth;
  /* overflow-x: clip вместо hidden — clip не активирует scroll-context
     и не отвязывает position: sticky дочерних элементов (TOC на /product).
     Старый fallback на hidden оставлен для браузеров без поддержки clip. */
  overflow-x: hidden;
  overflow-x: clip;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-page);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.4s ease, color 0.4s ease;
}

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

/* ===== Layout primitives ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
}

.container-wide {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text);
}

h1 {
  font-size: var(--display-1);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.05;
}

h2 {
  font-size: var(--display-2);
  font-weight: 800;
  letter-spacing: -0.03em;
}

h3 {
  font-size: var(--display-3);
  font-weight: 700;
}

p {
  line-height: 1.6;
}

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

code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* ===== Focus ===== */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Скрыть outline для click-фокуса (мышь), оставить для клавиатуры */
:focus:not(:focus-visible) {
  outline: none;
}

/* ===== Selection ===== */
::selection {
  background: var(--primary);
  color: #fff;
}

/* ===== Safe area для notch ===== */
@supports (padding: env(safe-area-inset-top)) {
  body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
}

/* ===== Mobile typography ===== */
@media (max-width: 480px) {
  .container,
  .container-wide {
    padding: 0 16px;
  }
}
