html {
  font-family: var(--font-body);
  font-size: 16px;
  background: var(--color-bg);
  color: var(--color-fg);
  scroll-behavior: smooth;
  transition: background var(--transition), color var(--transition);
}

body {
  min-height: 100vh;
  background: var(--color-bg);
  font-feature-settings: 'ss01', 'ss02', 'cv11';
  letter-spacing: -0.005em;
}

/* Decorative grain — текстурный слой поверх фона */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.035;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.6 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: multiply;
}

[data-theme="dark"] body::before {
  opacity: 0.06;
  mix-blend-mode: screen;
}

main, header, footer {
  position: relative;
  z-index: 2;
}

.container {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(20px, 4vw, 40px);
}

.section {
  padding-block: clamp(60px, 10vw, 120px);
  position: relative;
}

.section--alt {
  background: var(--color-surface-alt);
  border-block: var(--border-thick);
}

.section--dark {
  background: var(--color-graphite);
  color: var(--color-fg);
}

/* Typography */
h1, h2, h3, h4 {
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

h1 {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 7vw, 5.5rem);
  text-transform: uppercase;
  letter-spacing: -0.04em;
  line-height: 0.92;
}

h2 {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4.5vw, 3.5rem);
  text-transform: uppercase;
  letter-spacing: -0.02em;
  line-height: 0.95;
}

h3 {
  font-size: clamp(1.125rem, 1.8vw, 1.4rem);
  letter-spacing: -0.015em;
}

p {
  line-height: 1.55;
  text-wrap: pretty;
}

a {
  transition: color var(--transition-fast);
}

/* Section header with index marker */
.section-header {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-5);
  align-items: end;
  margin-bottom: var(--space-7);
  padding-bottom: var(--space-5);
  border-bottom: var(--border-thick);
}

.section-header__index {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: var(--space-2) var(--space-3);
  background: var(--color-accent);
  color: var(--color-accent-fg);
  align-self: start;
  border-radius: 12px;
}

.section-header__title {
  margin: 0;
}

.section-header__lead {
  grid-column: 2;
  color: var(--color-muted);
  font-size: clamp(0.95rem, 1.3vw, 1.1rem);
  max-width: 60ch;
  margin-top: var(--space-3);
}

/* Utility */
.text-accent { color: var(--color-accent); }
.text-mono { font-family: var(--font-mono); }
.uppercase { text-transform: uppercase; letter-spacing: 0.1em; }

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