/* ==========================================================================
   Строительный портал — reset и базовая типографика
   ========================================================================== */

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

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fz-body);
  line-height: var(--lh-body);
  font-weight: var(--fw-regular);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd { margin: 0; }
ul[class], ol[class] { list-style: none; margin: 0; padding: 0; }

h1 { font-size: var(--fz-h1); line-height: var(--lh-h1); font-weight: var(--fw-bold); letter-spacing: -.02em; }
h2 { font-size: var(--fz-h2); line-height: var(--lh-h2); font-weight: var(--fw-bold); letter-spacing: -.015em; }
h3 { font-size: var(--fz-h3); line-height: var(--lh-h3); font-weight: var(--fw-semi); letter-spacing: -.01em; }
h4 { font-size: var(--fz-h4); line-height: var(--lh-h4); font-weight: var(--fw-semi); }

a {
  color: var(--brand);
  text-decoration: none;
  transition: color var(--t-fast) var(--ease);
}
a:hover { color: var(--brand-strong); }

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

button, input, select, textarea {
  font: inherit;
  color: inherit;
}
button { cursor: pointer; border: none; background: none; padding: 0; }

table { border-collapse: collapse; width: 100%; }

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--s-5) 0;
}

code, kbd, samp { font-family: var(--font-num); font-size: .9em; }

::selection { background: var(--brand-soft); color: var(--text); }

/* --- Фокус: видимый всегда, но не при клике мышью ------------------------ */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* --- Скрытие для скринридеров ------------------------------------------- */
.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;
}
.skip-link {
  position: absolute; top: -100px; left: var(--s-4);
  z-index: var(--z-toast);
  background: var(--surface); color: var(--text);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-sm); box-shadow: var(--sh-md);
}
.skip-link:focus { top: var(--s-4); }

/* --- Утилиты ------------------------------------------------------------- */
.u-muted   { color: var(--text-muted); }
.u-faint   { color: var(--text-faint); }
.u-sm      { font-size: var(--fz-sm); line-height: var(--lh-sm); }
.u-xs      { font-size: var(--fz-xs); line-height: var(--lh-xs); }
.u-semi    { font-weight: var(--fw-semi); }
.u-bold    { font-weight: var(--fw-bold); }
.u-num     { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.u-center  { text-align: center; }
.u-right   { text-align: right; }
.u-nowrap  { white-space: nowrap; }
.u-hidden  { display: none !important; }
.u-self    { color: var(--c-self); }
.u-pro     { color: var(--c-pro); }
.u-danger  { color: var(--c-danger); }

.u-stack     { display: flex; flex-direction: column; gap: var(--s-4); }
.u-stack-sm  { display: flex; flex-direction: column; gap: var(--s-2); }
.u-stack-lg  { display: flex; flex-direction: column; gap: var(--s-6); }
.u-row       { display: flex; align-items: center; gap: var(--s-3); }
.u-row-wrap  { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.u-between   { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); }
.u-grow      { flex: 1 1 auto; min-width: 0; }
.u-spacer    { flex: 1 1 auto; }

.mt-0 { margin-top: 0; }      .mt-2 { margin-top: var(--s-2); }
.mt-3 { margin-top: var(--s-3); } .mt-4 { margin-top: var(--s-4); }
.mt-5 { margin-top: var(--s-5); } .mt-6 { margin-top: var(--s-6); }
.mb-2 { margin-bottom: var(--s-2); } .mb-3 { margin-bottom: var(--s-3); }
.mb-4 { margin-bottom: var(--s-4); } .mb-5 { margin-bottom: var(--s-5); }
.mb-6 { margin-bottom: var(--s-6); }

/* --- Уважение к настройкам движения -------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* --- Печать --------------------------------------------------------------- */
@media print {
  .site-header, .site-footer, .no-print, .toast-host, .modal-host { display: none !important; }
  body { background: #fff; color: #000; }
  a[href]::after { content: " (" attr(href) ")"; font-size: .8em; color: #555; }
}
