/**
 * TritonVPN — визуальный слой: футуризм + динамика + оптимизация.
 * Принципы: анимации в основном opacity/transform, уважение prefers-reduced-motion,
 * облегчение теней на мобильных, content-visibility для секций ниже сгиба.
 */

html {
  text-rendering: optimizeLegibility;
  color-scheme: dark;
}

body {
  text-wrap: pretty;
}

::selection {
  background: rgba(0, 240, 255, 0.22);
  color: #f8fbff;
}

/* Доступный фокус */
:where(a, button, input:not([type="hidden"]), textarea, select):focus-visible {
  outline: 2px solid rgba(0, 240, 255, 0.55);
  outline-offset: 3px;
}

/* —— Шапка —— */
.topbar-inner {
  position: relative;
  isolation: isolate;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.07) inset,
    0 12px 42px rgba(0, 0, 0, 0.4),
    0 0 56px rgba(0, 200, 255, 0.08);
  transition: box-shadow 0.4s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.35s ease;
}

/* —— Кабинет —— */
.page-card {
  border-color: rgba(140, 190, 255, 0.18);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.05) inset,
    0 32px 100px rgba(0, 0, 0, 0.5),
    0 0 100px rgba(80, 130, 220, 0.08);
  transition:
    box-shadow 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.4s ease,
    transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

@media (hover: hover) and (min-width: 769px) {
  .page-card:hover {
    border-color: rgba(0, 240, 255, 0.26);
    box-shadow:
      0 0 0 1px rgba(0, 240, 255, 0.09) inset,
      0 40px 120px rgba(0, 0, 0, 0.55),
      0 0 120px rgba(0, 210, 255, 0.12);
    transform: translateY(-2px);
  }
}

/* —— Вход / регистрация —— */
.shell .card {
  border-color: rgba(140, 190, 255, 0.18);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.05) inset,
    0 32px 100px rgba(0, 0, 0, 0.5),
    0 0 90px rgba(100, 140, 220, 0.08);
  transition: box-shadow 0.45s ease, border-color 0.35s ease, transform 0.45s ease;
}

@media (hover: hover) and (min-width: 769px) {
  .shell .card:hover {
    border-color: rgba(0, 240, 255, 0.24);
    box-shadow:
      0 0 0 1px rgba(0, 240, 255, 0.08) inset,
      0 40px 110px rgba(0, 0, 0, 0.55),
      0 0 100px rgba(0, 200, 255, 0.1);
    transform: translateY(-2px);
  }
}

.shell .card h1 {
  background: linear-gradient(120deg, #f0f6ff 0%, #c8e8ff 45%, #a5d8ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.shell .field input[type="email"],
.shell .field input[type="password"],
.shell .field input[type="text"] {
  transition:
    border-color 0.25s ease,
    box-shadow 0.25s ease,
    background 0.25s ease;
}

.shell .field input:hover {
  border-color: rgba(160, 200, 255, 0.32);
  background: rgba(6, 10, 22, 0.75);
}

.sidebar {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 20px 60px rgba(0, 0, 0, 0.35);
  transition: box-shadow 0.35s ease, border-color 0.35s ease;
}

.dashboard-main {
  transition: filter 0.3s ease;
}

/* —— Лендинг: секции ниже первого экрана (меньше работы композитора при скролле) —— */
#plans,
#devices,
#why,
#stats {
  content-visibility: auto;
  contain-intrinsic-size: auto 400px;
}

main > section:last-of-type {
  content-visibility: auto;
  contain-intrinsic-size: auto 280px;
}

/* Акцент в герое — движение градиента (только background-position) */
@keyframes site-accent-flow {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

.hero h1 .accent {
  background-size: 220% 100%;
  animation: site-accent-flow 11s ease-in-out infinite;
}

/* Подписи секций — лёгкий «пульс» яркости через opacity */
@keyframes site-label-glow {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.86;
  }
}

.section-label {
  letter-spacing: 0.14em;
  text-shadow: 0 0 28px rgba(0, 240, 255, 0.15);
  animation: site-label-glow 6s ease-in-out infinite;
}

/* Кнопки CTA: без filter (дешевле по отрисовке), только тень + transform */
.btn.btn-primary {
  position: relative;
  overflow: hidden;
  box-shadow:
    0 4px 20px rgba(0, 200, 255, 0.25),
    0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  transition:
    transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.3s ease;
}

.btn.btn-primary:hover {
  box-shadow:
    0 10px 36px rgba(0, 220, 255, 0.38),
    0 0 0 1px rgba(255, 255, 255, 0.14) inset,
    0 0 48px rgba(0, 200, 255, 0.12);
  transform: translateY(-2px);
}

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

.hero-copy h1,
.hero h1 {
  text-shadow: 0 0 80px rgba(0, 100, 140, 0.25);
}

.bento-card {
  transition:
    border-color 0.35s ease,
    box-shadow 0.4s ease,
    transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  contain: layout style;
}

@media (hover: hover) {
  .bento-card:hover {
    border-color: rgba(0, 240, 255, 0.22);
    box-shadow:
      0 0 0 1px rgba(0, 240, 255, 0.06) inset,
      0 24px 70px rgba(0, 0, 0, 0.45),
      0 0 60px rgba(0, 180, 255, 0.08);
  }
}

.bottom-note {
  letter-spacing: 0.02em;
  opacity: 0.92;
}

.btn-auth {
  transition:
    transform 0.22s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.28s ease,
    border-color 0.22s ease;
}

.btn-auth:hover {
  transform: translateY(-1px);
}

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

/* Юридические */
.doc {
  border-color: rgba(140, 190, 255, 0.18);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.045) inset,
    0 32px 100px rgba(0, 0, 0, 0.48),
    0 0 90px rgba(80, 130, 220, 0.07);
  transition: box-shadow 0.45s ease, border-color 0.35s ease, transform 0.4s ease;
}

@media (hover: hover) and (min-width: 769px) {
  .doc:hover {
    border-color: rgba(0, 240, 255, 0.22);
    box-shadow:
      0 0 0 1px rgba(0, 240, 255, 0.07) inset,
      0 38px 110px rgba(0, 0, 0, 0.52),
      0 0 100px rgba(0, 200, 255, 0.09);
    transform: translateY(-2px);
  }
}

.doc h1 {
  background: linear-gradient(115deg, #f4f8ff 0%, #d4ecff 50%, #b8e0ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.doc .doc-note {
  border-color: rgba(0, 240, 255, 0.12);
  background: rgba(4, 8, 20, 0.72);
}

/* Подписка: карточки тарифов — изоляция слоя для hover */
.plan-card {
  contain: layout style;
}

/* —— Доп. динамика / «живой» интерфейс (преимущественно transform / opacity) —— */

/* Редкий блик по шапке */
.topbar-inner::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    100deg,
    transparent 0%,
    rgba(255, 255, 255, 0.12) 48%,
    transparent 56%
  );
  transform: translateX(-70%) skewX(-14deg);
  opacity: 0;
  animation: site-topbar-shine 7.5s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

.topbar-inner > * {
  position: relative;
  z-index: 1;
}

/* Лендинг: шапка без .topbar-inner — тот же блик на «капсуле» */
.header-shell {
  position: relative;
  isolation: isolate;
}

.header-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    100deg,
    transparent 0%,
    rgba(255, 255, 255, 0.1) 48%,
    transparent 56%
  );
  transform: translateX(-70%) skewX(-14deg);
  opacity: 0;
  animation: site-topbar-shine 8.5s ease-in-out infinite;
  animation-delay: 1.1s;
  pointer-events: none;
  z-index: 0;
}

.header-shell > * {
  position: relative;
  z-index: 1;
}

@keyframes site-topbar-shine {
  0%,
  76%,
  100% {
    opacity: 0;
    transform: translateX(-80%) skewX(-14deg);
  }
  82% {
    opacity: 0.58;
    transform: translateX(78%) skewX(-14deg);
  }
}

/* Логотип в шапке — лёгкое дыхание */
@keyframes site-logo-breathe {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.065);
  }
}

.topbar .logo-mark,
.header-shell .logo-mark {
  animation: site-logo-breathe 6s ease-in-out infinite;
  transform-origin: center;
}

/* Заголовки страниц кабинета */
.page-head h1 {
  background: linear-gradient(118deg, #f8fbff 0%, #c8e8ff 48%, #9bd8ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  background-size: 200% 100%;
  animation: site-accent-flow 13s ease-in-out infinite;
}

/* Профиль: акцент в приветствии */
.welcome-accent {
  background: linear-gradient(105deg, #5cf7d2 0%, #00e5ff 45%, #c4b5fd 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  background-size: 210% 100%;
  animation: site-accent-flow 9s ease-in-out infinite;
}

/* Блок текущего тарифа — мягкий перелив рамки */
@keyframes site-cbox-border {
  0%,
  100% {
    border-color: rgba(120, 160, 220, 0.2);
  }
  50% {
    border-color: rgba(0, 245, 255, 0.52);
  }
}

.current-box {
  animation: site-cbox-border 5s ease-in-out infinite;
}

/* Панель ключей Happ */
@keyframes site-keys-border {
  0%,
  100% {
    border-color: rgba(100, 140, 200, 0.14);
  }
  50% {
    border-color: rgba(0, 230, 255, 0.45);
  }
}

.keys-inner {
  animation: site-keys-border 5.5s ease-in-out infinite;
}

/* Happ: кнопка — редкий блик */
.btn-happ-primary {
  position: relative;
  overflow: hidden;
}

.btn-happ-primary::before {
  content: "";
  position: absolute;
  top: -10%;
  left: -40%;
  width: 45%;
  height: 120%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.22),
    transparent
  );
  transform: skewX(-22deg) translateX(-120%);
  animation: site-happ-shine 3.8s ease-in-out infinite;
  pointer-events: none;
}

@keyframes site-happ-shine {
  0%,
  70%,
  100% {
    transform: skewX(-22deg) translateX(-120%);
    opacity: 0;
  }
  78% {
    opacity: 0.95;
    transform: skewX(-22deg) translateX(280%);
  }
}

/* Лендинг: карточка в герое слегка «парит» */
@keyframes site-hero-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-14px);
  }
}

.hero-visual {
  animation: site-hero-float 6.5s ease-in-out infinite;
}

/* Лендинг: колонки — появление при загрузке */
@keyframes site-pillar-rise {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.pillars .pillar {
  animation: site-pillar-rise 0.78s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.pillars .pillar:nth-child(1) {
  animation-delay: 0.05s;
}
.pillars .pillar:nth-child(2) {
  animation-delay: 0.12s;
}
.pillars .pillar:nth-child(3) {
  animation-delay: 0.19s;
}
.pillars .pillar:nth-child(4) {
  animation-delay: 0.26s;
}
.pillars .pillar:nth-child(5) {
  animation-delay: 0.33s;
}
.pillars .pillar:nth-child(6) {
  animation-delay: 0.4s;
}

/* CTA: тонкий блик по кнопке */
.btn.btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    105deg,
    transparent 38%,
    rgba(255, 255, 255, 0.14) 50%,
    transparent 62%
  );
  transform: translateX(-120%) skewX(-12deg);
  opacity: 0;
  animation: site-cta-sheen 5.5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes site-cta-sheen {
  0%,
  75%,
  100% {
    opacity: 0;
    transform: translateX(-130%) skewX(-12deg);
  }
  82% {
    opacity: 1;
    transform: translateX(130%) skewX(-12deg);
  }
}

/* Сайдбар: ссылки чуть «оживают» */
@media (hover: hover) {
  .side-link {
    transition:
      transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
      color 0.22s ease,
      background 0.22s ease,
      border-color 0.22s ease,
      box-shadow 0.28s ease;
  }

  .side-link:hover {
    transform: translateX(5px);
    box-shadow: -4px 0 20px rgba(0, 200, 255, 0.08);
  }
}

/* —— Мобильные: меньше теней, без hover-подъёма (тач) —— */
@media (max-width: 768px) {
  .page-card,
  .shell .card,
  .doc {
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.04) inset,
      0 16px 48px rgba(0, 0, 0, 0.42),
      0 0 40px rgba(60, 100, 180, 0.05);
  }

  .page-card:hover,
  .shell .card:hover,
  .doc:hover {
    transform: none;
  }

  .topbar-inner {
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.06) inset,
      0 8px 28px rgba(0, 0, 0, 0.35);
  }
}

/* —— Уменьшение движения: отключаем циклы, укорачиваем переходы —— */
@media (prefers-reduced-motion: reduce) {
  .hero h1 .accent,
  .section-label {
    animation: none;
  }

  .topbar-inner::before,
  .header-shell::before,
  .topbar .logo-mark,
  .header-shell .logo-mark,
  .page-head h1,
  .welcome-accent,
  .current-box,
  .keys-inner,
  .btn-happ-primary::before,
  .hero-visual,
  .pillars .pillar,
  .btn.btn-primary::after {
    animation: none;
  }

  .page-head h1,
  .welcome-accent {
    background-size: 100% 100%;
  }

  .pillars .pillar {
    opacity: 1;
    transform: none;
  }

  .side-link:hover {
    transform: none;
    box-shadow: none;
  }

  .page-card,
  .shell .card,
  .bento-card,
  .plan-card,
  .doc,
  .btn.btn-primary,
  .btn-auth,
  .topbar-inner {
    transition-duration: 0.05s;
  }

  .page-card:hover,
  .shell .card:hover,
  .doc:hover {
    transform: none;
  }
}
