/* База: reset, документ, сетка, шкала текста, состояния движения. Сырых значений здесь нет – только токены. */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }   /* слова-призраки шире экрана не дают горизонтального скролла */
body {
  min-height: 100dvh;
  background: color-mix(in srgb, var(--color-bg-fog) calc(var(--fog-mix) * 100%), var(--color-bg-page));   /* экран implant – серый, плавно */
  color: var(--color-fg);
  font-family: var(--font-text);
  font-size: var(--fs-body-m);
  line-height: var(--lh-body);
  letter-spacing: var(--ls-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img, video, canvas, svg { display: block; max-width: 100%; }
img, video { height: auto; }
button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; padding: 0; }
h1, h2, h3, h4 { font-size: inherit; font-weight: inherit; }
p, h1, h2, h3, h4 { overflow-wrap: break-word; }
h1, h2, h3 { text-wrap: balance; }
p, li { text-wrap: pretty; }

/* Сетка: контейнер с полями и 12 колонок. Ширина элементов – через grid-column, не через px */
.wrapper {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--page-margin);
}
.grid-12 {
  display: grid;
  grid-template-columns: repeat(var(--columns), minmax(0, 1fr));
  column-gap: var(--gutter);
}
.section {
  position: relative;
  z-index: var(--z-content);
  padding-block: var(--space-section);
}
.section--sheet {
  background: var(--color-bg-sheet);
}

/* Шкала текста. Размер текста в правилах секций не ставится – только эти классы.
   Заголовки смешивают начертания в одной фразе (как у Ivory Clinic): обычное – тонкое, <b> – выделенное, .faded – бледное */
.display-xl { font-family: var(--font-display); font-size: var(--fs-display-xl); line-height: var(--lh-display); letter-spacing: var(--ls-display); font-weight: var(--fw-light); }
.display-s  { font-family: var(--font-display); font-size: var(--fs-display-s);  line-height: var(--lh-display-s); letter-spacing: var(--ls-display-s); font-weight: var(--fw-light); }
.display-xl b, .display-s b, .title-m b { font-weight: var(--fw-medium); }
.display-l  { font-family: var(--font-display); font-size: var(--fs-display-l);  line-height: var(--lh-num); letter-spacing: var(--ls-num); font-weight: var(--fw-thin); }
.display-xs { font-family: var(--font-display); font-size: var(--fs-display-xs); line-height: var(--lh-num); letter-spacing: var(--ls-display-s); font-weight: var(--fw-light); }
.title-m    { font-family: var(--font-display); font-size: var(--fs-title-m);    line-height: var(--lh-title); letter-spacing: var(--ls-title); font-weight: var(--fw-regular); }
.title-s    { font-family: var(--font-display); font-size: var(--fs-title-s);    line-height: var(--lh-label); letter-spacing: var(--ls-title); font-weight: var(--fw-medium); }
.title-xxs  { font-family: var(--font-display); font-size: var(--fs-title-xxs);  line-height: var(--lh-label); font-weight: var(--fw-medium); }
.body-l     { font-size: var(--fs-body-l); line-height: var(--lh-lead); color: var(--color-fg-muted); }
.body-m     { font-size: var(--fs-body-m); }
.body-s     { font-size: var(--fs-body-s); line-height: var(--lh-cap); font-weight: var(--fw-medium); color: var(--color-fg-muted); }
.brand      { font-family: var(--font-display); font-size: var(--fs-brand); line-height: var(--lh-title); letter-spacing: var(--ls-brand); font-weight: var(--fw-medium); }   /* имя клиники – логотип */
.ghost-word { font-family: var(--font-display); font-size: var(--fs-ghost); line-height: var(--lh-ghost); letter-spacing: var(--ls-ghost); font-weight: var(--fw-light); color: var(--color-bg-fog); white-space: nowrap; }
.brand-word { font-family: var(--font-display); font-size: var(--fs-brand-word); line-height: var(--lh-brand-word); letter-spacing: var(--ls-ghost); font-weight: var(--fw-medium); color: var(--color-bg-fog); white-space: nowrap; }
.unit       { font-size: var(--fs-unit); letter-spacing: var(--ls-title); color: var(--color-fg-muted); }
.faded      { color: var(--color-fg-faded); }
.muted      { color: var(--color-fg-muted); }

/* Движение: пока JS не подготовил элемент, он скрыт – но только когда движение включено (html.has-motion).
   Без JS, в ?static и при prefers-reduced-motion класса нет, и всё видно сразу */
.has-motion [data-reveal]:not(.is-ready) { visibility: hidden; }

/* Холст сцены: единственное абсолютное позиционирование по умолчанию (docs/scene.md) */
[data-scene] { position: relative; }
[data-scene] canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: var(--z-scene); }
[data-scene] > :not(canvas) { position: relative; z-index: var(--z-content); }
[data-scene].is-live .scene__fallback { display: none; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

@media (max-width: 768px) {
  .wrapper { padding-inline: var(--page-margin-mobile); }
  .section { padding-block: var(--space-section-mobile); }
}
