/* DustDOG — reset, типографика, сетка, кнопки, карточки, таблицы */

*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 8px);
}
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: var(--t-body);
  line-height: 1.55;
  font-weight: 400;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
@supports (overflow: clip) { body { overflow-x: clip; } }

/* бумажное «зерно». Растровая texture-paper.webp (IMAGES.md №5) давала заметный повтор пятен
   с шагом 512 px на больших светлых плоскостях — заменена мелким процедурным шумом без пятен. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 160px;
  opacity: .07;
}

img, svg, canvas { display: block; max-width: 100%; }
img { height: auto; }
h1, h2, h3, h4, p, ul, ol, figure, table, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }
button { font: inherit; color: inherit; }
table { border-collapse: collapse; }

/* доступность */
.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;
}
.skip-link {
  position: fixed;
  left: 16px; top: 12px;
  z-index: 100;
  padding: 12px 18px;
  background: var(--ink);
  color: var(--ink-on-dark);
  border-radius: var(--r-m);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform .2s var(--ease-out);
}
.skip-link:focus { transform: translateY(0); }

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
  border-radius: 4px;
}
.on-dark :focus-visible,
.on-dark:focus-visible { outline-color: var(--ink-on-dark); }

/* контейнер и сетка */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.grid-12 {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 24px;
}

/* типографика */
.label {
  font-family: var(--font-mono);
  font-size: var(--t-label);
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  line-height: 1.4;
  color: var(--ink-2);
}
.on-dark .label { color: var(--ink-on-dark-2); }
.label-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin-bottom: var(--s-5);
}

.h1, .h2 {
  font-family: var(--font-display);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  line-height: .95;
  overflow-wrap: break-word;
  hyphens: manual;
}
.h1 { font-size: var(--t-h1); }
.h2 { font-size: var(--t-h2); }
/* Unbounded очень широкий: длинные слова («ОТПРАВЛЯТЬ.», «КОМПЬЮТЕР.») не должны рваться посередине.
   Кегль ограничен шириной колонки-контейнера (≈ 9,4 em на самое длинное слово). */
@supports (font-size: 1cqi) {
  .h2 { font-size: min(var(--t-h2), 10.6cqi); }
  .h2-sm { font-size: calc(var(--t-h3) * 1.4); }
}
.h2-host { container-type: inline-size; }
.h3 {
  font-family: var(--font-text);
  font-size: var(--t-h3);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.005em;
}
.lead {
  font-size: var(--t-lead);
  line-height: 1.5;
  color: var(--ink-2);
}
.on-dark .lead { color: var(--ink-on-dark-2); }
.text { color: var(--ink-2); max-width: 46ch; }
.on-dark .text { color: var(--ink-on-dark-2); }
.small { font-size: var(--t-small); line-height: 1.5; }
.mono {
  font-family: var(--font-mono);
  letter-spacing: .02em;
}
.accent { color: var(--accent); }
.nw { white-space: nowrap; }

/* кнопки */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 48px;
  padding: 18px 28px;
  border-radius: var(--r-m);
  font-family: var(--font-text);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.1;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .2s, color .2s, border-color .2s, transform .2s var(--ease-out), box-shadow .2s;
}
.btn .i { width: 20px; height: 20px; transition: transform .2s var(--ease-out); }
.btn-primary {
  background: var(--accent-cta);
  color: #fff;
  border: 0;
}
.btn-primary:hover {
  background: var(--accent-cta-hover);
  transform: translateY(-1px);
  box-shadow: 0 12px 28px var(--accent-glow);
}
.btn-primary:hover .i { transform: translateX(3px); }
.btn-primary:active { transform: translateY(0); box-shadow: none; }
.btn-primary:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.btn-secondary {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--ink);
}
.btn-secondary:hover { background: var(--ink); color: var(--bg); }
.btn-ghost {
  background: transparent;
  color: var(--ink-on-dark);
  border: 1.5px solid var(--ink-on-dark-2);
}
.btn-ghost:hover { border-color: var(--ink-on-dark); }

/* иконки */
.i {
  width: 24px;
  height: 24px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* бейджи и точки состояний */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: var(--r-s);
  font-size: var(--t-small);
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
}
.badge-demo {
  font-family: var(--font-mono);
  font-size: var(--t-label);
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.badge-ok    { background: var(--ok-soft);    color: var(--ok-ink); }
.badge-err   { background: var(--err-soft);   color: var(--err-ink); }
.badge-warn  { background: var(--warn-soft);  color: var(--warn-ink); }
.badge-muted { background: var(--muted-soft); color: var(--muted-ink); }

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex: none;
  background: var(--muted);
}
.dot-ok   { background: var(--ok); }
.dot-err  { background: var(--err); }
.dot-warn { background: var(--warn); }
.dot-muted{ background: var(--muted); }

/* карточки */
.card {
  background: var(--bg-paper);
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  padding: 28px;
  transition: border-color .2s;
}
.card:hover { border-color: var(--ink-3-deco); }

.glass {
  background: rgba(255,255,255,.92);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--r-l);
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass {
    background: var(--glass);
    -webkit-backdrop-filter: blur(14px) saturate(1.2);
    backdrop-filter: blur(14px) saturate(1.2);
  }
}
.glass-accent {
  background: var(--glass-accent);
  border-color: rgba(255,170,140,.9);
  color: #fff;
}

/* таблица «Демо-данные» */
.demo-table {
  width: 100%;
  font-size: var(--t-small);
  text-align: left;
}
.demo-table caption {
  caption-side: top;
  text-align: left;
  padding: 0 0 var(--s-3);
}
.demo-table th {
  font-family: var(--font-mono);
  font-size: var(--t-label);
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.demo-table td {
  height: 52px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  color: var(--ink);
}
.demo-table tbody tr:last-child td { border-bottom: 0; }
.demo-table .mono { font-size: 13px; }

/* движение: уважаем системную настройку */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition: none !important;
  }
  .btn-primary:hover,
  .btn-primary:active { transform: none; box-shadow: none; }
  .btn-primary:hover .i { transform: none; }
}
