:root {
  --bg: #050505;
  --fg: #f2f2f2;
  --muted: rgba(242, 242, 242, 0.45);
  --line: rgba(242, 242, 242, 0.12);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-weight: 400;
  font-size: clamp(15px, 1.1vw, 17px);
  line-height: 1.55;
  letter-spacing: 0.01em;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
}

#canvas-wrap {
  position: fixed;
  inset: 0;
  z-index: 0;
}

#canvas-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
}

main {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh; /* учитывает динамические тулбары мобильных браузеров */
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: clamp(1.25rem, 4vw, 2.75rem);
  /* Защита от челки/нижней панели iPhone */
  padding-top: max(clamp(1.25rem, 4vw, 2.75rem), env(safe-area-inset-top));
  padding-bottom: max(clamp(1.25rem, 4vw, 2.75rem), env(safe-area-inset-bottom));
  padding-left: max(clamp(1.25rem, 4vw, 2.75rem), env(safe-area-inset-left));
  padding-right: max(clamp(1.25rem, 4vw, 2.75rem), env(safe-area-inset-right));
  max-width: 1200px;
  margin: 0 auto;
}

main::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    rgba(5, 5, 5, 0.94) 0%,
    rgba(5, 5, 5, 0.55) 42%,
    transparent 72%
  );
}

@media (max-width: 640px) {
  main::before {
    background: linear-gradient(
      180deg,
      rgba(5, 5, 5, 0.92) 0%,
      rgba(5, 5, 5, 0.45) 45%,
      transparent 78%
    );
  }
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1rem;
}

.logo {
  font-family: "IBM Plex Sans", sans-serif;
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--fg);
}

header a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  transition: color 0.35s var(--ease);
}

header a:hover {
  color: var(--fg);
}

.icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  transition: color 0.35s var(--ease), border-color 0.35s var(--ease),
    background 0.35s var(--ease), transform 0.35s var(--ease);
}

.icon-link svg {
  width: 18px;
  height: 18px;
  display: block;
}

.icon-link:hover {
  color: var(--bg);
  background: var(--fg);
  border-color: var(--fg);
  transform: translateY(-1px);
}

.hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(2rem, 8vh, 5rem) 0;
  max-width: 32rem;
}

.hero h1 {
  font-family: "IBM Plex Sans", sans-serif;
  font-weight: 200;
  font-size: clamp(2.5rem, 8vw, 4.25rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 1.25rem;
}

.hero h1 strong {
  font-weight: 600;
  display: block;
}

.hero-title {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  font-family: "IBM Plex Sans", sans-serif;
  font-weight: 200;
  margin-bottom: 2rem;
  gap: 0;
}

.hero-title .word {
  display: block;
  font-weight: 200;
  line-height: 1;
  font-feature-settings: "kern" 1, "liga" 1;
}

/* Цель — маленькое, как «kicker», приглушённое, расширенный трекинг. */
.hero-title .word--lg {
  font-size: clamp(1.2rem, 3vw, 1.5rem);
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.6rem;
}

/* Путь — среднее, полусветлое, нейтральный трекинг. */
.hero-title .word--md {
  font-size: clamp(2rem, 5vw, 2.75rem);
  letter-spacing: -0.005em;
  color: rgba(242, 242, 242, 0.82);
  margin-bottom: 0.18rem;
}

/* Результат — кульминация: крупное, чистый белый, тугой трекинг. */
.hero-title .word--xl {
  font-size: clamp(3.25rem, 8.8vw, 4.75rem);
  letter-spacing: -0.045em;
  color: var(--fg);
  line-height: 0.94;
}

/* ── i18n‑смена языков ─────────────────────────────────────────────────── */
/* RTL‑слова и подзаголовок принудительно прижимаем к левому краю,
   чтобы арабский не вставал «по центру/справа». */
.hero-title .word[dir="rtl"],
.hero .tag[dir="rtl"] {
  text-align: left;
  unicode-bidi: isolate;
}

/* На время смены прячем «старое» состояние. Анимации входа/выхода. */
@keyframes hero-leave {
  0%   { opacity: 1; transform: translateY(0)    translateZ(0); filter: blur(0); }
  100% { opacity: 0; transform: translateY(-10px) translateZ(0); filter: blur(3px); }
}

@keyframes hero-enter {
  0%   { opacity: 0; transform: translateY(14px) translateZ(0); filter: blur(4px); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: translateY(0)    translateZ(0); filter: blur(0); }
}

.hero-title .word,
.hero .tag {
  will-change: opacity, transform, filter;
}

.hero-title.is-leaving .word,
.hero .tag.is-leaving {
  animation: hero-leave 0.42s var(--ease) forwards;
}

.hero-title.is-entering .word,
.hero .tag.is-entering {
  animation: hero-enter 0.55s var(--ease) both;
}

/* Лёгкий стаггер по словам: «Цель» уходит/приходит первой,
   затем «Путь», потом «Результат» — даёт ощущение волны. */
.hero-title.is-leaving .word--lg { animation-delay: 0s; }
.hero-title.is-leaving .word--md { animation-delay: 0.06s; }
.hero-title.is-leaving .word--xl { animation-delay: 0.12s; }

.hero-title.is-entering .word--lg { animation-delay: 0s; }
.hero-title.is-entering .word--md { animation-delay: 0.07s; }
.hero-title.is-entering .word--xl { animation-delay: 0.14s; }

@media (prefers-reduced-motion: reduce) {
  @keyframes hero-leave {
    from { opacity: 1; }
    to   { opacity: 0; }
  }
  @keyframes hero-enter {
    from { opacity: 0; }
    to   { opacity: 1; }
  }
  .hero-title.is-leaving .word,
  .hero .tag.is-leaving,
  .hero-title.is-entering .word,
  .hero .tag.is-entering {
    animation-duration: 0.6s;
  }
}

.hero .tag {
  font-size: clamp(0.875rem, 1.5vw, 0.9375rem);
  font-weight: 400;
  letter-spacing: 0.02em;
  line-height: 1.5;
  text-transform: none;
  color: var(--muted);
  max-width: 26rem;
  margin-bottom: 2.5rem;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: center;
}

a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.5rem;
  border: 1px solid var(--fg);
  color: var(--bg);
  background: var(--fg);
  text-decoration: none;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  transition: background 0.35s var(--ease), color 0.35s var(--ease),
    border-color 0.35s var(--ease);
}

a.btn:hover {
  background: transparent;
  color: var(--fg);
  border-color: var(--line);
}

a.link-quiet {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  border-bottom: 1px solid transparent;
  transition: color 0.35s var(--ease), border-color 0.35s var(--ease);
}

a.link-quiet:hover {
  color: var(--fg);
  border-bottom-color: var(--line);
}

footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

footer .link-quiet {
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 0.75rem;
}

footer .loc {
  letter-spacing: 0.08em;
}

@media (min-width: 900px) {
  .hero {
    max-width: 38rem;
  }
}

/* ── Мобильные экраны ────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Прижимаем текст к верху, оставляя нижнюю половину под сферу. */
  .hero {
    justify-content: flex-start;
    padding: 0.5rem 0 6rem;
    max-width: 100%;
  }

  /* Заголовок: чуть «приглушаем» крайности, чтобы влезало комфортно. */
  .hero-title {
    margin-bottom: 1.25rem;
  }

  .hero-title .word--lg {
    font-size: clamp(1.05rem, 4.2vw, 1.25rem);
    margin-bottom: 0.45rem;
  }

  .hero-title .word--md {
    font-size: clamp(1.85rem, 6.8vw, 2.4rem);
  }

  .hero-title .word--xl {
    font-size: clamp(3rem, 12.5vw, 4rem);
    line-height: 0.95;
  }

  /* Подпись чуть крупнее, чтобы читалась пальцами с расстояния. */
  .hero .tag {
    font-size: 0.95rem;
    line-height: 1.45;
    max-width: 22rem;
    margin-bottom: 1rem;
  }

  /* Шапка плотнее. */
  header {
    padding-bottom: 0.75rem;
  }

  /* Подвал: выравниваем по краям, мельче трекинг для емэйла. */
  footer {
    align-items: center;
    font-size: 0.625rem;
    gap: 0.5rem 1rem;
  }

  footer .link-quiet {
    font-size: 0.78rem;
    /* Минимальная зона тапа 44px по гайдлайнам Apple. */
    padding: 0.35rem 0;
  }
}

/* Очень узкие экраны — стек подвала колонкой. */
@media (max-width: 380px) {
  footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .hero-title .word--xl {
    font-size: clamp(2.6rem, 13vw, 3.5rem);
    letter-spacing: -0.05em;
  }
}

/* Альбомная ориентация на телефонах: всё компактнее по вертикали. */
@media (max-width: 900px) and (orientation: landscape) {
  .hero {
    padding: 0.25rem 0 1rem;
    justify-content: center;
  }

  .hero-title .word--xl {
    font-size: clamp(2.2rem, 6vw, 3rem);
  }

  .hero .tag {
    margin-bottom: 0.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
