/* Дополнительные стили для низкого заряда батареи */
.low-battery-mode * {
  animation-duration: 0.01ms !important;
  transition-duration: 0.01ms !important;
}

/* Стили для медленного соединения */
.slow-connection .logo-cloud,
.slow-connection .notice-layer,
.slow-connection .card::after {
  display: none !important;
}

.slow-connection .card {
  background: rgba(20, 20, 20, 0.9) !important;
  backdrop-filter: none !important;
}

/* Улучшение производительности скролла */
* {
  -webkit-overflow-scrolling: touch;
}

/* Оптимизация для GPU */
.card,
.nav-bar,
.link-btn {
  transform: translateZ(0);
  will-change: transform;
}

/* Отключение анимаций при prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Улучшение контрастности для accessibility */
@media (prefers-contrast: high) {
  .card {
    border: 2px solid rgba(255, 255, 255, 0.3);
  }

  .link-btn {
    border: 2px solid rgba(255, 255, 255, 0.4);
  }

  .nav-bar a {
    border: 1px solid rgba(255, 255, 255, 0.2);
  }
}

/* Dark mode оптимизация */
@media (prefers-color-scheme: dark) {
  body {
    background-color: #000;
  }

  .card {
    background: rgba(10, 10, 10, 0.8) !important;
  }
}

/* Оптимизация для печати */
@media print {
  .nav-bar,
  .notice-layer,
  .link-btn,
  .footer {
    display: none !important;
  }

  .card {
    page-break-inside: avoid;
    background: white !important;
    color: black !important;
  }
}

/* Улучшение для сенсорных устройств */
@media (hover: none) and (pointer: coarse) {
  .link-btn,
  .nav-bar a,
  button {
    min-height: 44px;
    min-width: 44px;
  }

  /* Убираем hover эффекты на touch устройствах */
  .link-btn:hover,
  .nav-bar a:hover,
  .card:hover {
    transform: none;
  }
}

/* Оптимизация для маленьких экранов в landscape */
@media (max-height: 500px) and (orientation: landscape) {
  .nav-bar {
    position: relative;
    top: 0;
  }

  .hero-title {
    font-size: 24px;
  }

  .card {
    padding: 12px;
  }

  .server-metrics {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Улучшение для очень больших экранов */
@media (min-width: 1920px) {
  .container {
    max-width: 1600px;
    margin: 0 auto;
  }

  .content {
    max-width: 1400px;
  }
}

/* Оптимизация шрифтов */
@supports (font-variation-settings: normal) {
  body {
    font-feature-settings: "kern" 1;
    text-rendering: optimizeLegibility;
  }
}

/* Улучшение производительности анимаций */
@media (prefers-reduced-motion: no-preference) {
  .card,
  .link-btn,
  .nav-bar a {
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  }
}

/* Оптимизация для fold устройств */
@media (min-width: 600px) and (max-width: 900px) {
  .cards {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
}

/* Улучшение для iPad и планшетов */
@media (min-width: 768px) and (max-width: 1024px) {
  .nav-bar {
    width: 90%;
  }

  .content {
    width: 88%;
  }

  .card {
    max-width: 600px;
  }

  .server-metrics {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Оптимизация focus для клавиатурной навигации */
*:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.8);
  outline-offset: 2px;
}

/* Скрытие outline для мыши */
*:focus:not(:focus-visible) {
  outline: none;
}

/* Улучшение для screen readers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Оптимизация загрузки изображений */
img {
  content-visibility: auto;
}

/* Улучшение производительности для длинных списков */
.logo-badges,
.contact-grid {
  contain: layout style paint;
}

/* Оптимизация для notch устройств (iPhone X+) */
@supports (padding: max(0px)) {
  .nav-bar {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }

  .content {
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
  }
}
