/* ==========================================================================
   0. TTNorms Font Face Declarations (Новые шрифты)
   ========================================================================== */
@font-face {
    font-family: 'TTNorms';
    src: url('fonts/TTNorms-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'TTNorms';
    src: url('fonts/TTNorms-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'TTNorms';
    src: url('fonts/TTNorms-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'TTNorms';
    src: url('fonts/TTNorms-ExtraBold.ttf') format('truetype');
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}

/* ==========================================================================
   1. CSS Переменные
   ========================================================================== */
:root {
  --primary-color: #3B82F6;
  --primary-color-hover: #2563EB;
  --accent-color: #60A5FA;

  --background-color: #0F172A;          /* slate-900 */
  --tile-background: #131a24;
  --text-color: #F8FAFC;                 /* slate-50 */
  --text-color-light: rgba(248, 250, 252, 0.6);
  --border-color: rgba(255, 255, 255, 0.10);

  --shadow-sm: 0 8px 20px rgba(0, 0, 0, 0.20);
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.30);
  
  /* Переменная для скролла с fallback */
  --scroll-progress: 0;
}

/* ==========================================================================
   2. База
   ========================================================================== */
* { margin: 0; padding: 0; box-sizing: border-box }
body {
  /* ИЗМЕНЕНИЕ: Замена 'Manrope' на 'TTNorms' */
  font-family: 'TTNorms', system-ui, -apple-system, Segoe UI, Roboto, Inter, sans-serif;
  color: var(--text-color);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--background-color);
  
  /* ИСПРАВЛЕНИЕ: Для более чистого рендеринга шрифтов и устранения "прыжков" */
  text-rendering: optimizeLegibility; 
}

/* --- ОБНОВЛЁННЫЙ КОД ДЛЯ ЭФФЕКТА ЗЕРНА (более мелкого) --- */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  z-index: -1;
  pointer-events: none;

  /* * === ИЗМЕНЕНИЯ ЗДЕСЬ ===
   * 1. viewBox: 200x200 -> 100x100 (тайл стал меньше)
   * 2. baseFrequency: 0.65 -> 1.2 (зерно стало мельче)
   * 3. numOctaves: 3 -> 1 (шум стал "чище", ушла "облачность")
   */
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 500 500"><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="1.5" numOctaves="1" stitchTiles="stitch" /></filter><rect width="100%" height="100%" filter="url(%23noise)" /></svg>');
  
  /* * Можешь уменьшить это значение, если шум покажется 
   * слишком интенсивным, например: opacity: 0.08;
   */
  mix-blend-mode: soft-light;
  opacity: 0.45;
}
/* --- КОНЕЦ НОВОГО КОДА --- */


/* * ==========================================================================
 * 2.1. Шторка (html body::before) УДАЛЕНА
 * ==========================================================================
 */
/* (Блок 'html body::before' полностью удален отсюда) */


.container { max-width: 1140px; margin: 0 auto; padding: 0 20px }
a { text-decoration: none }

/* ==========================================================================
   3. Скроллбар
   ========================================================================= */
::-webkit-scrollbar { width: 8px }
::-webkit-scrollbar-track { background: transparent }
::-webkit-scrollbar-thumb {
  background-color: rgba(59, 130, 246, 0.45);
  border-radius: 10px; border: 2px solid transparent; background-clip: content-box
}
::-webkit-scrollbar-thumb:hover { background-color: rgba(37, 99, 235, 0.8) }

/* ==========================================================================
   4. Общая анимация появления
   ========================================================================== */

/* * === ИЗМЕНЕНИЕ ЗДЕСЬ ===
 * Убираем 'main section' из этого селектора...
 */
header, footer { opacity: 0; animation: fadeIn .8s ease forwards }

/* * ...и добавляем анимацию к ПРЯМОМУ ПОТОМКУ 'main section'
 * (т.е. к .container, .hero-content-wrapper и т.д.)
 * Это должно исправить баг с 'mask-attachment: fixed'
 */
main section > * { opacity: 0; animation: fadeIn .8s ease forwards }

/* Анимация 'fadeIn' остается БЕЗ 'transform' */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ==========================================================================
   5. Заголовочная типографика
   ========================================================================== */
h1, h2, h3 { 
  /* ИЗМЕНЕНИЕ: Замена 'Inter' на 'TTNorms' */
  font-family: 'TTNorms', sans-serif; 
  letter-spacing: -.02em 
}

/* ==========================================================================
   6. Компоненты (Кнопки)
   ========================================================================== */
.btn {
  display: inline-block;
  padding: 14px 32px;
  border-radius: 18px;
  font-weight: 700;
  font-size: 16px;
  transition: background-color 0.2s ease-in-out, transform 0.2s ease-in-out;
}
.btn-cta {
  background: linear-gradient(165deg, var(--accent-color), var(--primary-color-hover));
  color: #fff;
  box-shadow:
    inset 0px 0.5px 4px rgba(255, 255, 255, 0.2),
    inset 0px -1px 1px rgba(0, 0, 0, 0.5);
}
.btn-cta:hover {
  filter: brightness(1.02);
  box-shadow:
    inset 0px 1px 4px rgba(255, 255, 255, 0.2),
    inset 0px -2px 3px rgba(0, 0, 0, 0.5);
  transform: translateY(-1px);
}
.btn-cta:active {
  transform: translateY(0px);
  filter: brightness(1.05);
  box-shadow:
    0 0 2px rgba(14, 165, 233, .3),
    inset 0px 1px 3px rgba(128, 128, 128, 0.2),
    inset 0px -2px 2px rgba(0, 0, 0, 0.5);
}
.cta-button-outline {
  display: inline-block;
  background-color: transparent;
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
  padding: 12px 30px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 16px;
  transition: all 0.2s ease-in-out;
}
.cta-button-outline:hover {
  background-color: var(--primary-color);
  color: #FFF;
  transform: translateY(-2px);
}

/* ==========================================================================
   7. Стеклянная шапка (Header)
   ========================================================================== */
.fixed-glass-header {
  position: fixed; /* ИЗМЕНЕНО: Было sticky */
  top: 20px;
  left: 0;
  width: 100%;
  z-index: 1000;
}

.glass-header-content {
  max-width: 1140px;
  margin: 0 auto;
  padding: 15px 30px;
  border-radius: 16px;
  background: rgba(0, 0, 0, calc(0.2 + 0.3 * var(--glass-scroll-progress, 0)));
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  box-shadow: 
    /* Внутренние тени */
    inset 0px 1px 0px rgba(255, 255, 255, 0.2),
    inset 0px 0px 1px rgba(0, 0, 0, 0.2),
    inset 0px -1px 3px rgba(0, 0, 0, 0.2),
    /* Внешние тени */
    var(--shadow-lg),
    0 8px 20px rgba(0, 0, 0, calc(0.2 * var(--glass-scroll-progress, 0)));
  display: flex;
  justify-content: space-between;
  align-items: center;

  /* === ИЗМЕНЕНИЯ ЗДЕСЬ (для шума) === */
  position: relative; /* 1. Для позиционирования псевдо-элемента */
  overflow: hidden;   /* 2. Чтобы шум обрезался по скругленным углам */
}

.glass-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 24px;
  color: var(--text-color);
  text-decoration: none;
}

.glass-logo img { 
  height: 40px; 
}

.glass-nav {
  display: flex;
  gap: 20px;
}

.glass-nav a {
  color: var(--text-color);
  font-weight: 700;
  text-decoration: none;
  transition: color 0.2s ease-in-out;
}

.glass-nav a:hover { 
  color: var(--primary-color); 
}

.glass-controls {
  display: flex;
  align-items: center;
  gap: 15px;
}

.glass-lang-switcher {
  color: var(--text-color);
  font-weight: 700;
  font-size: 16px;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 12px;
  transition: color 0.2s ease-in-out, background-color 0.2s ease-in-out;
}

.glass-lang-switcher:hover {
  color: var(--primary-color);
  background-color: rgba(255, 255, 255, 0.05);
}

.glass-btn {
  display: inline-block;
  padding: 14px 32px;
  border-radius: 18px;
  font-weight: 700;
  font-size: 16px;
  text-decoration: none;
  background: linear-gradient(165deg, var(--accent-color), var(--primary-color-hover));
  color: #fff;
  box-shadow:
    inset 0px 0.5px 4px rgba(255, 255, 255, 0.2),
    inset 0px -1px 1px rgba(0, 0, 0, 0.5);
  transition: background-color 0.2s ease-in-out, transform 0.2s ease-in-out;
}

.glass-btn:hover {
  filter: brightness(1.02);
  box-shadow:
    inset 0px 1px 4px rgba(255, 255, 255, 0.2),
    inset 0px -2px 3px rgba(0, 0, 0, 0.5);
  transform: translateY(-1px);
}

/* ==========================================================================
   8. Общие стили для всех секций
   ========================================================================== */
main {
  padding-top: 100px; /* Компенсация фиксированной шапки */
  
  /* * === ФИНАЛЬНЫЙ КОД: МАСКА ДЛЯ MAIN ===
   * Эта маска "прибита" к экрану (fixed) и будет "обрезать" 
   * только <main> (контент), оставляя фон (из background.css) видимым.
   */
  -webkit-mask-image: linear-gradient(
    to bottom, 
    transparent 0, 
    transparent 100px, /* Скрывает контент в верхних 100px */
    black 100px, 
    black 100%
  );
  mask-image: linear-gradient(
    to bottom, 
    transparent 0, 
    transparent 100px, 
    black 100px, 
    black 100%
  );
  
  /* Фиксируем маску относительно viewport */
  -webkit-mask-attachment: fixed;
  mask-attachment: fixed;
}

main section {
  padding: 100px 0;
  text-align: center;
}
main h2 {
  font-size: 40px;
  font-weight: 800;
  margin-bottom: 20px;
}
main p {
  font-size: 18px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  color: var(--text-color-light);
}

/* ==========================================================================
   9. Подвал (Footer)
   ========================================================================== */
.footer {
  color: var(--text-color-light);
  padding: 40px 0;
  text-align: center;
  border-top: 1px solid var(--border-color);
  background: rgba(11, 22, 32, 0.5); /* Полупрозрачный фон для подвала */
}
.footer a {
  color: var(--text-color);
  font-weight: 700;
}
.footer a:hover { color: var(--primary-color); }

/* ==========================================================================
   10. Эффект шума для стеклянной шапки (НОВЫЙ КОД)
   ========================================================================== */
.glass-header-content::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  
  /* Помещаем шум ЗА контент (ссылки, кнопки), но ПОВЕРХ фона шапки */
  z-index: -1; 
  pointer-events: none;

  /* Копируем тот же фон шума, что и у body */
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 500 500"><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="1.5" numOctaves="1" stitchTiles="stitch" /></filter><rect width="100%" height="100%" filter="url(%23noise)" /></svg>');
  
  /* Копируем те же настройки наложения */
  mix-blend-mode: soft-light;
  opacity: 0.15;
}