*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: var(--nav-h);
}

/* body stays transparent so the fixed .backdrop (z-index: -1) shows through; html carries the base colour. */
body {
  margin: 0;
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

img,
svg,
canvas {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3,
p,
ul,
ol,
figure {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--ton-bright);
  outline-offset: 3px;
  border-radius: 6px;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  position: relative;
  isolation: isolate;
  padding-block: var(--section-y);
}

.section__title {
  max-width: 20ch;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-h2);
  line-height: 1.12;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

/* Night sky behind the whole page: blue-black base and three soft pools of TON light.
   On desktop the pools drift (CSS translate/scale) and shift with scroll (GSAP transform). */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 40%, rgba(47, 84, 235, 0.07)), var(--bg);
}

.backdrop__blob {
  position: absolute;
  width: 72vmax;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--blob), transparent);
}

.backdrop__blob--a {
  --blob: rgba(0, 152, 234, 0.2);
  top: -32vmax;
  right: -26vmax;
}

.backdrop__blob--b {
  --blob: rgba(47, 84, 235, 0.2);
  top: 22%;
  left: -38vmax;
}

.backdrop__blob--c {
  --blob: rgba(51, 177, 255, 0.12);
  bottom: -42vmax;
  right: -8vmax;
}

@media (min-width: 1024px) {
  .backdrop__blob--a { animation: drift-a 28s var(--ease-drift) infinite alternate; }
  .backdrop__blob--b { animation: drift-b 34s var(--ease-drift) infinite alternate; }
  .backdrop__blob--c { animation: drift-c 40s var(--ease-drift) infinite alternate; }
}

@keyframes drift-a {
  to { translate: -10vmax 8vmax; scale: 1.15; }
}

@keyframes drift-b {
  to { translate: 12vmax -6vmax; scale: 0.9; }
}

@keyframes drift-c {
  to { translate: -14vmax -10vmax; scale: 1.2; }
}

.reduced .backdrop__blob {
  animation: none;
}

/* Faint dot grid, lit in the middle and fading to the edges. */
.dot-grid {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(rgba(148, 196, 255, 0.2) 1px, transparent 1.6px);
  background-size: 28px 28px;
  background-position: center;
  -webkit-mask-image: radial-gradient(ellipse 60% 55% at var(--grid-x, 50%) var(--grid-y, 50%), #000, transparent);
  mask-image: radial-gradient(ellipse 60% 55% at var(--grid-x, 50%) var(--grid-y, 50%), #000, transparent);
}

/* The bot's Telegram avatar as the logo mark: a small app icon with a TON glow. */
.logo-mark {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  box-shadow: 0 0 0 1px rgba(242, 245, 248, 0.12), 0 6px 22px rgba(0, 152, 234, 0.4);
  transition: rotate 0.5s var(--ease-out), scale 0.5s var(--ease-out);
}

.logo-mark--small {
  width: 28px;
  height: 28px;
  border-radius: 9px;
}

a:hover > .logo-mark {
  rotate: -8deg;
  scale: 1.08;
}

.skip-link {
  position: fixed;
  left: 12px;
  top: -80px;
  z-index: var(--z-skip);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--ton-deep);
  color: var(--white);
  font-weight: 600;
}

.skip-link:focus {
  top: 12px;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: var(--z-grain);
  pointer-events: none;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 24px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s, scale 0.15s var(--ease-out);
}

.btn:active {
  scale: 0.98;
}

.btn--primary {
  min-height: 56px;
  padding: 0 30px;
  background: var(--ton);
  color: var(--white);
  font-size: 1.1875rem;
  font-weight: 700;
  box-shadow: 0 14px 40px rgba(0, 152, 234, 0.28);
}

.btn--primary:hover {
  background: var(--ton-deep);
}

.btn--xl {
  min-height: 64px;
  padding: 0 40px;
  font-size: 1.25rem;
}

.btn--outline {
  min-height: 44px;
  padding: 0 18px;
  border: 1.5px solid var(--ton);
  color: var(--text);
  font-size: 0.9375rem;
}

.btn--outline:hover {
  background: var(--ton-soft);
}

.btn--ghost {
  min-height: 44px;
  padding: 0 8px;
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 500;
}

.btn--ghost:hover {
  color: var(--text);
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--ton-bright);
  font-weight: 500;
}

.link-arrow::after {
  content: '→';
  transition: translate 0.2s var(--ease-out);
}

.link-arrow:hover::after {
  translate: 4px 0;
}

.icon {
  display: inline-block;
  flex: none;
  width: 28px;
  height: 28px;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

.icon--ton { --icon: url('../assets/icons/ton.svg'); }
.icon--stars { --icon: url('../assets/icons/stars.svg'); }
.icon--cryptobot { --icon: url('../assets/icons/cryptobot.svg'); }
.icon--lolz { --icon: url('../assets/icons/lolz.svg'); }
.icon--card { --icon: url('../assets/icons/card.svg'); }

/* Start states for JS motion. The .motion class is dropped after 3 s if motion never starts. */
.motion [data-reveal],
.motion [data-hero-fade] {
  opacity: 0;
}

.motion .hero__title {
  visibility: hidden;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
