/**
 * Base Styles — базовая типографика, компоненты, сетка
 * Использует переменные из tokens.css
 */

/* ===== RESET & BASE ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ===== TYPOGRAPHY ===== */
h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  font-weight: var(--font-weight-black);
  line-height: var(--line-height-tight);
  letter-spacing: var(--letter-spacing-tight);
  color: var(--color-text);
}

h1 {
  font-size: var(--font-size-h1);
}

h2 {
  font-size: var(--font-size-h2);
}

h3 {
  font-size: var(--font-size-h3);
}

h4 {
  font-size: var(--font-size-h4);
}

h5 {
  font-size: var(--font-size-h5);
}

h6 {
  font-size: var(--font-size-h6);
}

p {
  margin: 0;
  line-height: var(--line-height-relaxed);
}

a {
  color: inherit;
  text-decoration: none;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

a:hover {
  opacity: 0.9;
}

a:focus-visible {
  outline: 2px solid var(--color-text);
  outline-offset: 4px;
  border-radius: var(--border-radius-sm);
}

/* ===== CONTAINER & GRID ===== */
.container {
  width: var(--container-width);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

/* ===== SECTIONS ===== */
section {
  padding: var(--space-section) 0;
  scroll-margin-top: calc(var(--topbar-height) + var(--space-4));
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--border-radius-full);
  border: var(--border-width) solid var(--color-border-strong);
  background: var(--color-accent);
  color: var(--color-text);
  font-family: inherit;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-extrabold);
  letter-spacing: var(--letter-spacing-wider);
  text-transform: uppercase;
  cursor: pointer;
  transition: transform var(--transition-base), background var(--transition-base), border-color var(--transition-base);
  -webkit-tap-highlight-color: transparent;
}

.btn:hover {
  transform: translateY(-1px);
  background: var(--color-accent-hover);
}

.btn:active {
  transform: translateY(0);
}

.btn:focus-visible {
  outline: 2px solid var(--color-text);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--color-text);
  color: var(--color-bg);
  border-color: var(--color-text);
}

.btn-primary:hover {
  background: var(--color-text-muted-strong);
  border-color: var(--color-text-muted-strong);
}

.btn-ghost {
  background: transparent;
  border-color: var(--color-border);
}

.btn-ghost:hover {
  background: var(--color-accent);
  border-color: var(--color-border-strong);
}

/* ===== CARDS ===== */
.card {
  border-radius: var(--border-radius-lg);
  border: var(--border-width) solid var(--color-border);
  background: var(--color-glass-bg);
  backdrop-filter: blur(var(--blur-lg));
  -webkit-backdrop-filter: blur(var(--blur-lg));
  padding: var(--space-6);
  box-shadow: var(--shadow-xl);
  transition: transform var(--transition-base), background var(--transition-base), box-shadow var(--transition-base);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2xl);
}

/* ===== LISTS ===== */
ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ===== FOCUS VISIBLE (a11y) ===== */
*:focus-visible {
  outline: 2px solid var(--color-text);
  outline-offset: 2px;
  border-radius: var(--border-radius-sm);
}

button:focus-visible,
a:focus-visible {
  outline-offset: 3px;
}

/* ===== SECTION TRANSITIONS ===== */
/* Универсальный механизм плавных переходов между секциями */
section {
  position: relative;
}

/* Переменные для управления переходами (можно переопределить на секции) */
section {
  --sep-color-top: var(--color-bg);
  --sep-color-bottom: var(--color-bg);
  --sep-strength: 1;
}

/* Плавный переход сверху (если нужен) */
section[data-sep-top="true"]::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: clamp(60px, 10vh, 120px);
  background: linear-gradient(
    to bottom,
    var(--sep-color-top) 0%,
    rgba(0, 0, 0, 0.4) 40%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 1;
  opacity: var(--sep-strength, 1);
}

/* Плавный переход снизу (если нужен) */
section[data-sep-bottom="true"]::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: clamp(60px, 10vh, 120px);
  background: linear-gradient(
    to top,
    var(--sep-color-bottom) 0%,
    rgba(0, 0, 0, 0.4) 40%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 1;
  opacity: var(--sep-strength, 1);
}

/* ===== REDUCED MOTION ===== */
@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;
  }
}

/* ===== UTILITIES ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

