/* Custom Properties & Reset */
:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-surface: #1f2937;
  --border-color: #374151;
  --accent-emerald: #10b981;
  --accent-emerald-hover: #059669;
  --text-main: #f9fafb;
  --text-muted: #ffffff;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --header-height: 72px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.5;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header & Navigation (Mobile-First) */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  height: var(--header-height);
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-link {
  display: inline-block;
  flex-shrink: 0;
}

.site-logo {
  width: 140px;
  height: 60px;
  object-fit: contain;
  display: block;
}
/* Базові стилі (Десктоп) */
.logo-img {
  font-family: 'Inter', 'Helvetica Neue', sans-serif;
  font-size: 24px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #3cef06;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.3s ease;
  
  /* Захист від випадання за межі контейнера */
  white-space: nowrap;
}

.logo-img:hover {
  opacity: 0.7;
}

/* Мобільна версія (для екранів менше 768px) */
@media (max-width: 768px) {
  .logo-img {
    font-size: 18px;          /* Зменшуємо шрифт */
    letter-spacing: 0.5px;    /* Зменшуємо відступи між літерами */
    max-width: 200px;         /* Обмежуємо максимальну ширину (налаштуйте під свій макет) */
    overflow: hidden;         /* Ховаємо те, що не влазить */
    text-overflow: ellipsis;  /* Додаємо '...' в кінці, якщо текст не поміщається */
  }
}

/* Для зовсім маленьких екранів (менше 380px), якщо логотип дуже довгий */
@media (max-width: 380px) {
  .logo-img {
    font-size: 16px;
    max-width: 150px;
  }
}

.burger-btn {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  width: 40px;
  height: 40px;
  padding: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 1001;
}

.burger-bar {
  width: 100%;
  height: 3px;
  background-color: var(--text-main);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.burger-btn.is-active .burger-bar:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.burger-btn.is-active .burger-bar:nth-child(2) {
  opacity: 0;
}

.burger-btn.is-active .burger-bar:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

.primary-nav {
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: 100%;
  height: calc(100vh - var(--header-height));
  background-color: var(--bg-secondary);
  transform: translateX(-100%);
  transition: transform 0.3s ease-in-out;
  padding: 2rem 1.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

.primary-nav.is-active {
  transform: translateX(0);
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.nav-link {
  color: var(--text-main);
  text-decoration: none;
  font-size: 1.125rem;
  font-weight: 600;
  transition: color 0.2s ease;
}

.nav-link:hover {
  color: var(--accent-emerald);
}

/* Layout Main Container */
.main-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem 1rem;
  width: 100%;
  flex: 1;
}

/* 2. Content Styling (.article Scope ONLY) */
.article h1 {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.25;
  color: var(--text-main);
  margin-bottom: 1.25rem;
}

.article h2 {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-main);
  margin: 2rem 0 1rem 0;
  border-left: 4px solid var(--accent-emerald);
  padding-left: 0.75rem;
}

.article h3 {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-main);
  margin: 1.5rem 0 0.75rem 0;
}

.article p {
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.article img {
  border-radius: 5px;
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.5rem 0;
}

.article ul, 
.article ol {
  margin: 0 0 1.25rem 0;
  padding-left: 1.5rem;
  color: var(--text-muted);
}

.article li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.article ul li::marker {
  color: var(--accent-emerald);
}

.article table {
  display: block;
  overflow-x: auto;
  width: fit-content;
  max-width: 100%;
  
  border-collapse: collapse;
  margin: 1.5rem auto;
  background-color: var(--bg-surface);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  -webkit-overflow-scrolling: touch;
}

.article table th,
.article table td {
  padding: 0.85rem 1rem;
  text-align: left;
}

.article table th {
  background-color: var(--bg-secondary);
  color: var(--accent-emerald);
  font-weight: 600;
  border-bottom: 2px solid var(--border-color);
  /* Заголовки краще тримати в один рядок */
  white-space: nowrap; 
}

.article table td {
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  
  /* Дозволяємо перенос тексту всередині комірок */
  white-space: normal;
  /* Запобігаємо розриву дуже довгих слів чи посилань */
  word-break: break-word; 
  min-width: 120px; /* Мінімальна ширина комірки, щоб текст не стискався в один стовпчик */
}

.article table tr:last-child td {
  border-bottom: none;
}

.article table tr:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.02);
}

/* 3. Author Block */
.author-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  margin-top: 3rem;
  text-align: center;
}

.author-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent-emerald);
  flex-shrink: 0;
}

.author-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.author-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.author-badge {
  display: inline-block;
  background-color: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.author-bio {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text-muted);
}

/* 4. Footer & Compliance */
.site-footer {
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 2.5rem 1rem 1.5rem;
  margin-top: auto;
}

.footer-container {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.footer-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.footer-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.footer-menu a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s ease;
}

.footer-menu a:hover {
  color: var(--text-main);
}

.footer-regulators {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  padding: 1rem 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.regulator-badge {
  width: 100px;
  height: 40px;
  object-fit: contain;
  display: block;
  filter: grayscale(30%);
  transition: filter 0.2s ease;
}

.regulator-badge:hover {
  filter: grayscale(0%);
}

.footer-legal {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease, background-color 0.2s ease;
  z-index: 999;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.back-to-top:hover {
  background-color: var(--accent-emerald-hover);
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
}

/* Desktop Responsive Layout (min-width: 768px) */
@media (min-width: 768px) {
  .burger-btn {
    display: none;
  }

  .header-container {
  
    gap: 2.5rem;
  }

  .primary-nav {
    position: static;
    height: auto;
    width: auto;
    background-color: transparent;
    transform: none;
    padding: 0;
    box-shadow: none;
  }

  .nav-list {
    flex-direction: row;
    gap: 1.75rem;
  }

  .nav-link {
    font-size: 0.95rem;
  }

  .article h1 {
    font-size: 2.25rem;
  }

  .article h2 {
    font-size: 1.6rem;
  }

  .author-block {
    flex-direction: row;
    text-align: left;
    align-items: flex-start;
  }

  .author-header {
    align-items: flex-start;
    flex-direction: row;
    gap: 0.75rem;
  }

  .footer-top {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .footer-menu {
    flex-direction: row;
    gap: 1.5rem;
  }

}
