/* ==========================================================================
   Chara Visuals — base.css
   Токены, сброс, типографика, сетка, служебные классы.
   ========================================================================== */

:root {
  /* Палитра (см. docs/concept.md) */
  --obsidian: #09090b;
  --obsidian-2: #101013;
  --deepslate: #18141b;
  --deepslate-2: #1f1923;
  --blackstone: #2a2330;
  --bone: #f1e9e6;
  --ash: #919198;
  --ash-2: #6d626e;

  /* Редстоун: сигнал и провод без сигнала */
  --signal: #ff2d42;
  --signal-hot: #ff6170;
  --signal-deep: #c8132c;
  --dust: #5c0c18;
  --dust-2: #33070e;

  --line: rgba(241, 233, 230, 0.075);
  --line-2: rgba(241, 233, 230, 0.13);
  --line-signal: rgba(255, 45, 66, 0.42);

  --surface: rgba(255, 255, 255, 0.025);
  --surface-2: rgba(255, 255, 255, 0.045);

  /* Типографика */
  --font-display: "Golos Text", system-ui, sans-serif;
  --font-text: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-pixel: "Pixelify Sans", "Golos Text", monospace;

  --fs-13: 0.8125rem;
  --fs-15: 0.9375rem;
  --fs-17: 1.0625rem;
  --fs-20: 1.25rem;
  --fs-24: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  --fs-32: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
  --fs-44: clamp(1.85rem, 1.3rem + 2.2vw, 2.75rem);
  --fs-60: clamp(2.2rem, 1.4rem + 3.4vw, 3.75rem);
  --fs-88: clamp(2.9rem, 1.6rem + 5.6vw, 5.5rem);
  --fs-132: clamp(3.4rem, 1.2rem + 9.6vw, 8.25rem);

  /* Геометрия */
  --radius-s: 10px;
  --radius-m: 16px;
  --radius-l: 24px;
  --px: 3px; /* шаг «пиксельного» угла */
  --container: 1240px;
  --gutter: clamp(16px, 4vw, 40px);
  --header-h: 76px;

  /* Движение */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-1: 160ms;
  --dur-2: 280ms;
  --dur-3: 520ms;

  color-scheme: dark;
}

/* --------------------------------------------------------------------------
   Сброс
   -------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 24px);
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--obsidian);
  color: var(--bone);
  font-family: var(--font-text);
  font-size: var(--fs-17);
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body.is-locked {
  overflow: hidden;
}

img,
video,
svg,
canvas,
iframe {
  display: block;
  max-width: 100%;
}

img,
video {
  height: auto;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
figure,
blockquote,
dl,
dd {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

[hidden] {
  display: none !important;
}

::selection {
  background: rgba(255, 45, 66, 0.4);
  color: #fff;
}

/* Полоса прокрутки — тонкая, в цвет «провода без сигнала» */
html {
  scrollbar-color: var(--blackstone) var(--obsidian);
  scrollbar-width: thin;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--obsidian);
}

::-webkit-scrollbar-thumb {
  background: var(--blackstone);
  border: 3px solid var(--obsidian);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--dust);
}

/* Видимый фокус клавиатуры — «запитанный» контур */
:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 3px;
  border-radius: 4px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* --------------------------------------------------------------------------
   Типографика
   -------------------------------------------------------------------------- */

.display,
h1,
h2 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.02;
  text-wrap: balance;
  overflow-wrap: break-word;
}

h1 {
  font-size: var(--fs-88);
}

h2 {
  font-size: var(--fs-60);
}

h3 {
  font-family: var(--font-text);
  font-size: var(--fs-24);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

h4 {
  font-size: var(--fs-17);
  font-weight: 600;
  line-height: 1.35;
}

p {
  text-wrap: pretty;
}

.lead {
  font-size: var(--fs-20);
  line-height: 1.55;
  color: var(--ash);
  max-width: 34em;
}

.muted {
  color: var(--ash);
}

.small {
  font-size: var(--fs-15);
}

.tiny {
  font-size: var(--fs-13);
}

.pixel {
  font-family: var(--font-pixel);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.prose {
  max-width: 68ch;
  color: var(--ash);
}

.prose h2 {
  font-size: var(--fs-32);
  color: var(--bone);
  margin: 2.2em 0 0.7em;
}

.prose h3 {
  font-size: var(--fs-20);
  color: var(--bone);
  margin: 1.8em 0 0.6em;
}

.prose p,
.prose ul,
.prose ol {
  margin-bottom: 1em;
}

.prose ol {
  list-style: decimal;
  padding-left: 1.4em;
}

.prose ul {
  list-style: none;
  padding-left: 0;
}

.prose ul li {
  position: relative;
  padding-left: 1.3em;
}

.prose ul li::before {
  content: "";
  position: absolute;
  left: 0.15em;
  top: 0.68em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--dust);
  box-shadow: 0 0 0 1px var(--signal-deep);
}

.prose li + li {
  margin-top: 0.45em;
}

.prose strong {
  color: var(--bone);
  font-weight: 600;
}

.prose a {
  color: var(--bone);
  text-decoration: underline;
  text-decoration-color: var(--signal-deep);
  text-underline-offset: 3px;
}

.prose a:hover {
  text-decoration-color: var(--signal);
}

/* Подстановки в шаблонах документов: [Наименование продавца] */
.fill {
  color: var(--signal-hot);
  background: rgba(255, 45, 66, 0.08);
  border-radius: 4px;
  padding: 0 0.25em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* --------------------------------------------------------------------------
   Раскладка
   -------------------------------------------------------------------------- */

.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.container--narrow {
  max-width: calc(880px + var(--gutter) * 2);
}

.section {
  position: relative;
  padding-block: clamp(72px, 9vw, 136px);
}

.section--tight {
  padding-block: clamp(48px, 6vw, 88px);
}

.section-head {
  display: grid;
  gap: 18px;
  margin-bottom: clamp(36px, 5vw, 64px);
  max-width: 820px;
}

.section-head p {
  color: var(--ash);
  font-size: var(--fs-20);
  line-height: 1.55;
  max-width: 34em;
}

.page-main {
  padding-top: calc(var(--header-h) + clamp(32px, 6vw, 72px));
}

.stack-s > * + * {
  margin-top: 10px;
}

.stack-m > * + * {
  margin-top: 20px;
}

.stack-l > * + * {
  margin-top: 36px;
}

.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: -60px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--signal);
  color: #fff;
  font-weight: 600;
  border-radius: 8px;
  transition: top var(--dur-2) var(--ease-out);
}

.skip-link:focus {
  top: 16px;
}

/* Общие мягкие углы для кнопок, полей и небольших поверхностей. */
.px-corners {
  border-radius: var(--radius-m);
}

/* --------------------------------------------------------------------------
   Фон страницы: едва заметная пиксельная сетка
   -------------------------------------------------------------------------- */

.page-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.35;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 0%, transparent 75%);
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 0%, transparent 75%);
}

/* --------------------------------------------------------------------------
   Появление при прокрутке — только для заголовков секций (см. concept.md)
   -------------------------------------------------------------------------- */

.js [data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 700ms var(--ease-out),
    transform 700ms var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}

.js [data-reveal].is-revealed {
  opacity: 1;
  transform: none;
}

/* --------------------------------------------------------------------------
   Переходы между страницами
   -------------------------------------------------------------------------- */

@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 320ms;
  animation-timing-function: var(--ease-out);
}

::view-transition-old(root) {
  animation-name: vt-out;
}

::view-transition-new(root) {
  animation-name: vt-in;
}

@keyframes vt-out {
  to {
    opacity: 0;
    filter: blur(6px);
  }
}

@keyframes vt-in {
  from {
    opacity: 0;
    filter: blur(6px);
  }
}

/* --------------------------------------------------------------------------
   Уменьшение движения
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }

  .js [data-reveal] {
    opacity: 1;
    transform: none;
  }
}
