/* =========================================
   GLOBAL SITE SYSTEM
========================================= */

:root {
  --primary-color: #1f1f1f;
  --text-color: #444;
  --bg-color: #ffffff;
  --border-color: #e9e9e9;
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg-color);
  color: var(--text-color);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.7;
}

/* =========================================
   GLOBAL LAYOUT WRAPPER
========================================= */

.wrapper {
  max-width: 1400px;
  margin: 0 auto;
  padding-left: 40px;
  padding-right: 40px;
  box-sizing: border-box;
}

/* =========================================
   HEADER SYSTEM
========================================= */

header {
  padding-top: 30px;
  padding-bottom: 30px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.logo img {
  height: 80px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-grow: 1;
  gap: 30px;
}

/* =========================================
   NAVIGATION
========================================= */

nav {
  margin-left: auto;
}

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

nav a {
  text-decoration: none;
  color: var(--primary-color);
  font-weight: 600;
  font-size: 16px;
  white-space: nowrap;
}

nav a:hover {
  opacity: 0.7;
}

/* =========================================
   LANGUAGE SWITCHER
========================================= */

.language-switcher {
  display: flex;
  gap: 12px;
  font-size: 14px;
  text-transform: uppercase;
}

.language-switcher a {
  text-decoration: none;
  color: #777;
  font-weight: 600;
}

.language-switcher a.active {
  color: black;
}

/* =========================================
   MAIN CONTENT AREA (Оптимізація та стабілізація)
========================================= */

main {
  padding-top: 40px; /* Спільний базовий старт для всіх типів сторінок */
  padding-bottom: 80px;
}

.main-content-area {
  width: 100%;
  margin: 0 auto;
  padding-top: 0;
  margin-top: 0 !important; /* Повністю знищуємо стрибки вгору */
}

/* =========================================
   GLOBAL TYPOGRAPHY
========================================= */

h1 {
  color: var(--primary-color);
  font-size: 64px;
  line-height: 1.1;
  letter-spacing: -1px;
  margin-top: 0;
  margin-bottom: 40px;
}

p {
  margin-top: 0;
  margin-bottom: 1.5rem;
}

/* Повне обнулення зовнішніх марджинів першого елемента контенту */
.main-content-area .content > p:first-of-type,
.main-content-area .content > p:first-child,
.main-content-area .content > h1:first-child {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* =========================================
   PREMIUM JOURNAL IMAGE SYSTEM (Фірмовий стиль "В клітинку")
========================================= */

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* 1. Головне зображення статті (Уніфікована журнальна обкладинка з рамкою #ebebeb) */
.main-content-area .content img:first-of-type,
.main-content-area .content > p:first-child img {
  width: 100% !important;
  max-width: 1320px !important;
  height: auto !important;
  margin-top: 0 !important;
  margin-left: auto !important;
  margin-right: auto !important;
  margin-bottom: 50px !important;
  
  /* Ідеальне інженерне рішення: тонка рамка для захисту меж фото */
  border: 1px solid #ebebeb !important; 
  border-radius: 4px !important;
  box-shadow: none !important;
}

/* 2. Стандартні зображення всередині тексту */
.main-content-area .content img:not(:first-of-type),
.main-content-area .content p ~ p img {
  width: 100% !important;
  max-width: 760px !important;
  height: auto !important;
  margin: 40px auto !important;
  border: 1px solid #ebebeb !important;
  border-radius: 4px !important;
}

/* 3. Маленькі технічні зображення / Інструкції */
.image-small img,
.small-image img,
.step-image img,
img.technical-small {
  max-width: 420px !important;
  margin: 30px auto !important;
  border: 1px solid #ebebeb !important;
  border-radius: 4px !important;
}

/* =========================================
   TOP AD / PARTNER AREA (Майбутній блок автоматичних біржових цін)
========================================= */

.ad-slot-top {
  width: 100%;
  min-height: 60px; /* Зменшено висоту для більшої компактності інформера */
  margin-top: 0;
  margin-bottom: 40px; /* Фіксований відступ, що відштовхує контент донизу на однакову відстань */
  background: #fafafa;
  border: 1px dashed #e9e9e9;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-sizing: border-box;
  font-size: 12px;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* =========================================
   DEVELOPMENT NOTICE
========================================= */

.dev-notice {
  margin-top: 40px;
  padding: 22px 26px;
  background: #fff8db;
  border: 1px solid #e7d48c;
  border-left: 6px solid #c7a93b;
  border-radius: 10px;
  font-size: 15px;
  line-height: 1.7;
  color: #5b4b18;
}

.dev-notice strong {
  display: block;
  margin-bottom: 10px;
  font-size: 17px;
}

.dev-notice p {
  margin: 0 0 16px 0;
}

.dev-notice p:last-child {
  margin-bottom: 0;
}

/* =========================================
   DISABLE THEME AUTO HERO
========================================= */

.page-services-single .service-single-image,
.page-services-single .service-image,
.page-services-single .intro-image,
.page-services-single .hero-image {
  display: none !important;
}

/* =========================================
   FOOTER
========================================= */

footer {
  border-top: 1px solid var(--border-color);
  padding-top: 50px;
  padding-bottom: 50px;
  margin-top: 80px;
}

.footer-grid {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 40px;
}

.footer-nav {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.footer-nav a {
  text-decoration: none;
  color: #666;
  font-size: 15px;
}

.footer-nav a:hover {
  color: black;
}

.footer-copy {
  color: #999;
  font-size: 14px;
}

/* =========================================
   FINAL VERTICAL RHYTHM FIX
========================================= */

.content > *:first-child {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* =========================================
   MOBILE ADAPTATION
========================================= */

@media (max-width: 1000px) {
  .wrapper {
    padding-left: 20px;
    padding-right: 20px;
  }

  header {
    flex-direction: column;
    gap: 20px;
  }

  .header-right {
    flex-direction: column;
    gap: 20px;
  }

  nav ul {
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
  }

  h1 {
    font-size: 42px;
  }

  .ad-slot-top {
    min-height: 60px;
    margin-bottom: 30px;
  }

  .main-content-area .content img:first-of-type,
  .main-content-area .content > p:first-child img {
    margin-bottom: 30px !important;
  }
}