/*
Theme Name: The NỌX System
Theme URI: https://noxsystem.net
Author: Serj May
Author URI: https://noxsystem.net
Description: Темная тема The NỌX System с поддержкой меню, хедера, футера и виджетов.
Version: 1.2
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: nox-system
*/

body {
  margin: 0;
  font-family: sans-serif;
  background: linear-gradient(to bottom right, #0e001a, #1a0033);
  color: #D8B9F2;
}

header {
  background-color: #7a5fb1;
  height: 70px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 8px 40px 0 40px;
  position: sticky;
  top: -70px;
  left: 0;
  right: 0;
  z-index: 1000;
  direction: ltr !important;
}

header .site-title,
header .site-logo-title,
header nav ul li a {
  direction: rtl;
  unicode-bidi: plaintext;
}

header .site-branding {
  font-size: 1.4em;
  font-weight: normal;
  color: #ccccff;
  display: flex;
  align-items: center;
  gap: 15px;
}

header .site-branding img {
  height: 40px;
}

header nav ul {
  list-style: none;
  display: flex;
  gap: 25px;
  align-items: center;
  font-size: 1.15em;
  margin: 0;
  padding: 0;
}

header nav ul li a {
  color: rgba(190, 179, 204, 0.7);
  font-weight: normal;
  font-size: 0.9em;
  text-decoration: none;
}

main {
  padding-top: 12vh;
  padding-bottom: 5vh;
}

footer {
  background-color: #140025;
  color: #888;
  text-align: center;
  padding: 20px;
}

header, footer {
  width: 100%;
}

.header-inner, .footer-inner {
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
}

.content-wrapper {
  width: 85%;
  margin: 0 auto;
  box-sizing: border-box;
}

h1 {
  text-align: center;
}

.menu-toggle {
  flex-direction: column;
  cursor: pointer;
}

.menu-toggle span {
  height: 3px;
  width: 25px;
  background: #D8B9F2;
  margin: 4px 0;
  border-radius: 2px;
}

nav ul {
  display: flex;
  gap: 20px;
  list-style: none;
  padding: 0;
  margin: 0;
  align-items: center;
}

/* ===== UPDATED: header menu visibility model ===== */
/* База: хедер-меню скрыто (исключает «мигание» на мобиле) */
header nav { display: none; }
/* Десктопы: показываем меню */
@media (min-width: 801px) {
  header nav { display: flex; }
}
/* ===== END UPDATED ===== */

.content-wrapper, .header-inner, .footer-inner {
  border: 1px solid rgba(216, 185, 242, 0.15);
  box-shadow: 0 0 12px rgba(216, 185, 242, 0.3);
  border-radius: 12px;
  padding: 20px;
}

nav ul li a {
  transition: all 0.3s ease;
  display: inline-block;
}

nav ul li a:hover {
  color: #D8B9F2;
  text-shadow: 0 0 8px #D8B9F2;
  transform: scale(1.1);
}

header img {
  max-width: width: 100vw;
  max-height: 100px;
  height: 100px;
  width: auto;
  object-fit: contain;
}

nav ul {
  padding-right: 30px;
}

.content-wrapper, .header-inner, .footer-inner {
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
}

footer p {
  text-align: center;
  margin: 20px auto;
}

.site-logo-title {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 60px;
}

.site-logo-title img {
  width: 44px;
  height: auto;
  max-height: 40px;
}

.site-title {
  font-size: 26px;
  color: rgba(204, 204, 204, 0.2); /* 0.5 = 50% непрозрачности The Nox Sys */
}

.menu {
  margin-right: 20px;
}

.custom-logo {
  max-height: 150px;
  width: auto;
  height: auto;
}

/* ===== Language Setting menu in footer — mobile only ===== */
.lang-menu--footer { 
  display: none;
}
.lang-menu--footer .lang-menu__list {
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 10px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
}
.lang-menu--footer .lang-menu__list a {
  font-size: 11px;
  line-height: 1.2;
  color: rgba(240,240,255,0.75);
  text-decoration: none;
  opacity: 0.9;
}
@media (max-width: 800px) {
  .lang-menu--footer { display: block; }
}

/* ===== Safari/Android — блокировка горизонтального скролла ===== */
html, body {
  overflow-x: hidden;
  overscroll-behavior-x: none;
  touch-action: pan-y;
}
#nox-canvas,
#nox-mobile-overlay {
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
}
@supports (-webkit-touch-callout: none) {
  body { position: relative; }
}

/* ===== FIX: Footer language menu — centered everywhere (incl. Safari), 2 rows on mobile ===== */

/* База: центровка и единая строка на широких (десктоп) */
.lang-menu--footer {
  display: flex;                 /* обёртка для гарантированного центрирования */
  justify-content: center;
  width: 100%;
}

.lang-menu--footer .lang-menu__list {
  /* grid с автоколонками по размеру контента; одна строка по умолчанию */
  display: grid !important;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  gap: 10px 14px;
  place-content: center;         /* центр сетки */
  place-items: center;           /* центр элементов */
  width: max-content;            /* критично для Safari: позволяет flex-обёртке центрировать блок */
  max-width: 100%;
  margin: 8px auto 12px;
  padding-inline: 10px;
  box-sizing: border-box;
  list-style: none;
  text-align: center;
}

/* Фолбэк на случай отсутствия grid (крайне старые браузеры) */
@supports not (display: grid) {
  .lang-menu--footer .lang-menu__list {
    display: flex !important;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 14px;
    width: 100%;
  }
}

.lang-menu--footer .lang-menu__list > li { min-width: 0; }

.lang-menu--footer .lang-menu__list a {
  display: inline-block;
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;           /* не ломаем слова */
  word-break: normal;
  overflow-wrap: normal;
  text-decoration: none;
  color: rgba(240,240,255,0.75);
  -webkit-hyphens: none;
          hyphens: none;
}

/* RTL языки внутри ссылок */
.lang-menu--footer .lang-menu__list a:lang(fa),
.lang-menu--footer .lang-menu__list a:lang(ar),
.lang-menu--footer .lang-menu__list a:lang(he) {
  direction: rtl;
  unicode-bidi: plaintext;
  text-align: center;
}

/* Узкие экраны: ровно две строки */
@media (max-width: 800px) {
  .lang-menu--footer .lang-menu__list {
    grid-template-rows: repeat(2, auto);
    overflow-x: hidden;          /* страховка от горизонтального скролла в Safari */
  }
}
