/* ============================================================
   ФЕНИКС · Слой 2: сброс, типографика, сетка, утилиты
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--bg-900);
  color: var(--txt-1);
  font-family: var(--ff-text);
  font-size: var(--fs-300);
  line-height: var(--lh-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body.is-locked { overflow: hidden; }

img, svg, video, canvas { display: block; max-width: 100%; }
img { height: auto; }

h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

a { color: inherit; text-decoration: none; }

button, input, textarea, select {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
}
button { cursor: pointer; }

::selection {
  background: var(--fx-orange);
  color: #0a0a0a;
}

/* ---------- Заголовки ---------- */

/* Unbounded — геометрический гротеск с крупным очком: на 800 он давит,
   рабочие начертания здесь 600–700. */
.h1, h1 {
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: var(--fs-h1);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  color: var(--txt-0);
  text-wrap: balance;
}

.h2, h2 {
  font-family: var(--ff-display);
  font-weight: 600;
  font-size: var(--fs-h2);
  line-height: var(--lh-head);
  letter-spacing: var(--ls-head);
  color: var(--txt-0);
  text-wrap: balance;
}

.h3, h3 {
  font-family: var(--ff-display);
  font-weight: 600;
  font-size: var(--fs-h3);
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--txt-0);
}

.h4 {
  font-family: var(--ff-display);
  font-weight: 600;
  font-size: var(--fs-400);
  line-height: 1.3;
  color: var(--txt-0);
}

.lead {
  font-size: var(--fs-lead);
  line-height: 1.55;
  color: var(--txt-1);
  text-wrap: pretty;
}

.muted { color: var(--txt-2); }

/* Технические подписи — моноширинный шрифт. Инженерный характер
   без единой картинки. */
.mono {
  font-family: var(--ff-mono);
  font-size: var(--fs-100);
  font-weight: 500;
  letter-spacing: var(--ls-mono);
  text-transform: uppercase;
  color: var(--txt-2);
}

/* Martian Mono вариативный: по умолчанию он очень широкий, поджимаем
   по оси wdth — иначе технические подписи занимают пол-строки. */
.mono, .index, .card__index, .field__label, .footer__title,
.logo__sub, .project__meta, .callout, .sketchfab__credit,
.services__num, .process__step-num {
  font-variation-settings: 'wdth' 85;
}

/* Номер-маркер секции — часть мотива «чертёж поверх реальности» */
.index {
  font-family: var(--ff-mono);
  font-size: var(--fs-100);
  font-weight: 500;
  letter-spacing: var(--ls-mono);
  color: var(--fx-orange);
}

.accent { color: var(--fx-orange); }

/* ---------- Сетка ---------- */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--pad-x);
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--gutter);
}

.section {
  position: relative;
  padding-block: var(--section-y);
}

.section--tight { padding-block: calc(var(--section-y) * .62); }

/* Шапка секции: номер + заголовок + подпись — единый паттерн для всего сайта */
.section-head {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  margin-bottom: var(--s-9);
  max-width: 60ch;
}

.section-head__top {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}

.section-head__rule {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line) 0%, transparent 100%);
  max-width: 140px;
}

/* ---------- Доступность ---------- */

:focus-visible {
  outline: 2px solid var(--fx-orange);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

.skip-link {
  position: absolute;
  left: var(--s-4);
  top: -100px;
  z-index: var(--z-preloader);
  padding: var(--s-3) var(--s-5);
  background: var(--fx-orange);
  color: #0a0a0a;
  border-radius: var(--r-sm);
  font-weight: 600;
  transition: top var(--t-fast) var(--e-out);
}
.skip-link:focus { top: var(--s-4); }

.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;
}

/* ---------- Появление блоков ---------- */
/* Работает без JS: если скрипт не загрузился, класс .is-in никто не
   поставит — поэтому базовое состояние видимое, а прячем только когда
   документ помечен как «js есть». */

html.js [data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .8s var(--e-out), transform .8s var(--e-out);
  will-change: opacity, transform;
}
html.js [data-reveal].is-in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html.js [data-reveal] { opacity: 1; transform: none; transition: none; }
}
