/* =========================================================
   Gambit Games — base.css
   Сброс, токены палитры, типографика, утилиты.
   ========================================================= */

/* ---------- Токены ---------- */
:root {
  --container: 1320px;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: 6rem;

  --header-h: 56px;

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dur: 200ms;

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* ---------- Тёмная тема (единственная): тёмный с фиолетовым оттенком ---------- */
  --bg: #131020;
  --bg-elev: #1b1729;
  --bg-elev-2: #241f36;
  --border: #2e2840;
  --border-strong: #3d3657;

  --text: #e9e8f2;
  --text-muted: #a29fb8;
  --text-faint: #746f8c;

  --accent: #6c5ce7;
  --accent-hover: #8375f0;
  --accent-contrast: #ffffff;
  --accent-soft: rgba(108, 92, 231, 0.16);

  --focus: #8b7cff;
  --danger: #ff6b6f;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 12px 34px rgba(0, 0, 0, 0.55);
  --shadow-accent: 0 12px 34px rgba(108, 92, 231, 0.35);

  color-scheme: dark;
}

/* ---------- Сброс ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--space-4));
}

body {
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img,
svg,
video {
  display: block;
  max-width: 100%;
  height: auto;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  list-style: none;
  padding: 0;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

::selection {
  background: var(--accent);
  color: var(--accent-contrast);
}

/* ---------- Типографика ---------- */
h1,
h2,
h3,
h4 {
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(1.9rem, 1.2rem + 3vw, 3rem);
}

h2 {
  font-size: clamp(1.4rem, 1.1rem + 1.6vw, 2rem);
}

h3 {
  font-size: 1.15rem;
}

p {
  text-wrap: pretty;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.1em 0.4em;
}

/* ---------- Утилиты ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-5);
}

.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;
  top: var(--space-3);
  left: var(--space-3);
  z-index: 100;
  padding: var(--space-3) var(--space-4);
  background: var(--accent);
  color: var(--accent-contrast);
  border-radius: var(--radius-sm);
  font-weight: 600;
  transform: translateY(calc(-100% - var(--space-5)));
  transition: transform var(--dur) var(--ease);
}

.skip-link:focus-visible {
  transform: translateY(0);
}

/* Скрыто, если JS отключён (элементы, которые заполняет скрипт) */
[hidden] {
  display: none !important;
}

/* ---------- Уважение prefers-reduced-motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
