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

html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* едва заметная зернистость, как у камня, вместо гладкой заливки */
  background:
    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 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .035 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    var(--bg);
  color: var(--text);
  font: 15px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body.no-scroll { overflow: hidden; }

main { flex: 1; outline: none; }
main.enter { animation: page-in 0.4s var(--ease); }

@keyframes page-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
ul { margin: 0; padding: 0; list-style: none; }
dl, dd { margin: 0; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--accent); color: var(--accent-ink); }

.container { width: 100%; max-width: calc(var(--container) + var(--gutter) * 2); margin: 0 auto; padding: 0 var(--gutter); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.display { font-family: var(--display); font-weight: 600; letter-spacing: 0; }
.muted { color: var(--muted); }
.accent { color: var(--accent); }
.icon { flex-shrink: 0; }

/* Пиксельные углы-лесенки. Рамка — это фон самого элемента, заливка — ::before с отступом в толщину рамки,
   обе обрезаны одной лесенкой, поэтому рамка идёт ступеньками, а не срезается.
   --s — размер ступеньки, --bw — толщина рамки, --px-line и --px-fill — цвета. Список ниже — все такие блоки сайта */
:is(.px, .pcard, .feature, .stats, .release, .sidecard, .latest, .member, .cta, .term, .file, .avatar, .search, .segmented, .ptab, .empty-card, .langmenu__list, .notice) {
  --s: 3px;
  --bw: 2px;
  --px-line: var(--line);
  --px-fill: var(--surface);
  position: relative;
  isolation: isolate;
  background: var(--px-line);
  transition: background 0.2s;
}
:is(.px, .pcard, .feature, .stats, .release, .sidecard, .latest, .member, .cta, .term, .file, .avatar, .search, .segmented, .ptab, .empty-card, .langmenu__list, .notice)::before {
  content: "";
  position: absolute;
  inset: var(--bw);
  z-index: -1;
  background: var(--px-fill);
  transition: background 0.2s;
}
:is(.px, .pcard, .feature, .stats, .release, .sidecard, .latest, .member, .cta, .term, .file, .avatar, .search, .segmented, .ptab, .empty-card, .langmenu__list, .notice),
:is(.px, .pcard, .feature, .stats, .release, .sidecard, .latest, .member, .cta, .term, .file, .avatar, .search, .segmented, .ptab, .empty-card, .langmenu__list, .notice)::before {
  clip-path: polygon(
    0 calc(var(--s) * 2), var(--s) calc(var(--s) * 2), var(--s) var(--s), calc(var(--s) * 2) var(--s), calc(var(--s) * 2) 0,
    calc(100% - var(--s) * 2) 0, calc(100% - var(--s) * 2) var(--s), calc(100% - var(--s)) var(--s), calc(100% - var(--s)) calc(var(--s) * 2), 100% calc(var(--s) * 2),
    100% calc(100% - var(--s) * 2), calc(100% - var(--s)) calc(100% - var(--s) * 2), calc(100% - var(--s)) calc(100% - var(--s)), calc(100% - var(--s) * 2) calc(100% - var(--s)), calc(100% - var(--s) * 2) 100%,
    calc(var(--s) * 2) 100%, calc(var(--s) * 2) calc(100% - var(--s)), var(--s) calc(100% - var(--s)), var(--s) calc(100% - var(--s) * 2), 0 calc(100% - var(--s) * 2)
  );
}

.skip {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 100;
  padding: 8px 12px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
.skip:focus { top: 12px; }

/* загрузка до первого рендера: три мигающих пикселя */
.boot { min-height: 70vh; display: grid; place-items: center; }
.boot span { width: 8px; height: 8px; background: var(--accent); box-shadow: 14px 0 var(--accent), -14px 0 var(--accent); animation: boot 0.9s steps(3) infinite; }
@keyframes boot { 50% { opacity: 0.25; } }

/* появление при прокрутке: элементы с data-reveal ждут, пока до них долистают */
[data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); transition-delay: calc(var(--i, 0) * 70ms); }
[data-reveal].is-in { opacity: 1; transform: none; }

/* искры от кнопок скачивания */
.spark {
  position: fixed;
  z-index: 200;
  width: 6px;
  height: 6px;
  pointer-events: none;
  animation: spark 0.7s cubic-bezier(0.2, 0.6, 0.4, 1) forwards;
}
@keyframes spark {
  to { transform: translate(var(--dx), var(--dy)) scale(0.3); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  [data-reveal] { opacity: 1; transform: none; }
}
