/* ================================================================
   base.css — reset + typography base
   Depends: tokens.css
   ================================================================ */

/* Modern reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
* { text-overflow: clip; }  /* anti-truncation (DESIGN-LOCK §1) */

html {
  -webkit-text-size-adjust: 100%;
  -moz-tab-size: 4;
  tab-size: 4;
}

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

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

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

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

ul, ol { list-style: none; }

/* Разрешить transition для height:auto (details/accordion smooth open — Chrome 129+) */
:root { interpolate-size: allow-keywords; }

/* ─── Typography defaults (element-level, tokens applied) ─── */

h1, h2, h3, h4 {
  font-family: var(--font-sans);
  font-weight: var(--fw-bold);
  color: var(--c-fg);
  text-wrap: balance;   /* even-length lines для headings */
  hyphens: manual;      /* никаких auto-разрывов слов по слогам */
  word-break: normal;
  overflow-wrap: normal;
}
p, li {
  text-wrap: pretty;    /* устраняет orphans в body-тексте (Chrome 117+ / FF 121+ / Safari 17.5+) */
  hyphens: manual;
  word-break: normal;
  overflow-wrap: break-word;   /* только если слово реально длиннее контейнера (URL, тех.термин) */
}
h1 { font-size: var(--fs-h1);       line-height: var(--lh-display); letter-spacing: var(--ls-tight-3); }
h2 { font-size: var(--fs-h2);       line-height: var(--lh-display); letter-spacing: var(--ls-tight-2); }
h3 { font-size: var(--fs-h3);       line-height: var(--lh-h3);      letter-spacing: var(--ls-tight-1); }
h4 { font-size: var(--fs-body-lg);  line-height: var(--lh-h3); }

p {
  font-family: var(--font-sans);
  font-weight: var(--fw-regular);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--c-fg);
}

strong, b { font-weight: var(--fw-bold); }

/* ─── Focus visible — единый через accent ring ─── */
:where(a, button, input, textarea, select, [tabindex]):focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--c-accent);
  border-radius: var(--radius);
}

/* ─── Skip link for a11y ─── */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--page-padding-x);
  padding: var(--space-2) var(--space-3);
  background: var(--c-fg);
  color: var(--c-bg);
  font-size: var(--fs-body);
  z-index: 1000;
  border-radius: var(--radius);
}
.skip-link:focus { top: var(--space-2); }

/* ─── Utility ─── */
.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;
}
