/* ============================================================
   Base
   Reset, document defaults, animated site background,
   typography helpers and small shared primitives.
   ============================================================ */
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg-0);
  color: var(--fg-0);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  transition: background 0.5s var(--ease), color 0.5s var(--ease);
}

/* ---- Mobile safety net: nothing may force a horizontal scroll on a phone.
   Inline React styles can't be reached by CSS media queries, so this global guard is the
   backstop against a stray fixed-width child spilling past the viewport (the "text поехал"
   symptom). Images/media never exceed their column. ---- */
html, body { max-width: 100%; overflow-x: hidden; }
/* The 68px header is `position: fixed`, so a native hash jump (arriving at /#faq from an email
   or a search result) lands the section heading underneath it. smoothTo() offsets in-page nav
   clicks by hand; this covers everything it does not run for. */
html { scroll-padding-top: 84px; }
img, video, canvas { max-width: 100%; }

/* ---- Unified animated site background ---- */
body { position: relative; }
#root, #tweaks-root, #toast-root { position: relative; z-index: 1; }
.site-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  /* deep near-black base with a faint vertical sheen */
  background:
    radial-gradient(120% 80% at 50% -10%, #14161b 0%, #0c0d10 45%, #08090b 100%);
}
/* one very subtle, slow cool-blue aura that breathes — barely there */
.site-bg::before {
  content: ""; position: absolute; inset: -30%;
  background:
    radial-gradient(50% 45% at 30% 22%, color-mix(in oklab, var(--accent) 16%, transparent), transparent 70%),
    radial-gradient(55% 50% at 75% 75%, color-mix(in oklab, var(--accent) 11%, transparent), transparent 72%);
  /* No blur. This is already two soft radial gradients, and 90 CSS px is 270 device px of
     Gaussian on the largest layer on the page — 6.3 Mpx at phone DPR, above the fold, every
     frame the animation moves it. Screenshot-diffed with and without at 402px and 1440px:
     identical. The gradients were doing all the work; the blur was blurring a blur. */
  animation: bgDrift 40s ease-in-out infinite alternate;
  will-change: transform;
}
/* faint engineering grid, fades out to the edges */
.site-bg::after {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 72px 72px;
  opacity: 0.35;
  /* The mask is inert — at 0.35 opacity against this background the faded edge is already
     below one 8-bit step, and removing it is pixel-identical. It cost a full-viewport mask
     compositing pass that every backdrop-filter scrolling over it had to read through. */
}
@keyframes bgDrift {
  /* translate only. A scale() on a filtered layer invalidates its raster, so the aura was
     re-rendering across the whole 40 s loop instead of being a free composited transform. */
  0%   { transform: translate3d(-3%, -2%, 0); }
  100% { transform: translate3d(3%, 2%, 0); }
}
@media (prefers-reduced-motion: reduce) { .site-bg::before, .live-dot { animation: none; } }
::selection { background: var(--fg-0); color: var(--bg-0); }
::-webkit-scrollbar { width: 11px; }
::-webkit-scrollbar-track { background: var(--bg-0); }
::-webkit-scrollbar-thumb { background: var(--line-1); border-radius: 8px; border: 3px solid var(--bg-0); }
::-webkit-scrollbar-thumb:hover { background: var(--fg-3); }

.font-display { font-family: var(--font-display); letter-spacing: -0.03em; }
.font-serif   { font-family: var(--font-serif); font-style: italic; letter-spacing: 0; }
.font-mono    { font-family: var(--font-mono); }
.font-body    { font-family: var(--font-body); }
.text-balance { text-wrap: balance; }
.text-pretty  { text-wrap: pretty; }

.grid-bg {
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 64px 64px;
}
.grid-bg-fine {
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 28px 28px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--fg-2);
}

.live-dot {
  display: inline-block;
  width: 6px; height: 6px; border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent-line);
  animation: pulse 2.4s var(--ease) infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 var(--accent-line); }
  70%  { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

image-slot {
  --is-fg: var(--fg-2);
  --is-frame-bg: transparent;
  --is-ring: var(--line-1);
}

.slot-cap {
  position: absolute; inset: 0; z-index: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 24px; text-align: center; pointer-events: none;
}
.slot-cap-ic {
  display: inline-flex; width: 44px; height: 44px; border-radius: 12px;
  align-items: center; justify-content: center;
  border: 1px solid var(--line-1); color: var(--fg-3); background: var(--surface-veil);
}
.slot-cap-tx {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--fg-3); max-width: 34ch; line-height: 1.55;
}
