/* ==========================================================================
   1. КОЛІРНА ПАЛІТРА, СЕМАНТИКА ТА ТЕМИ
   ========================================================================== */

:root {
  /* Постійні акценти (не змінюються залежно від теми) */
  --primary: #D4AF37;
  --primary-dark: #AA8B2C;
  --white: #FFFFFF;
  --dark-grey: #1A1A1A;

  /* СЕМАНТИКА ДЛЯ СВІТЛОЇ ТЕМИ (За замовчуванням) */
  --bg-body: #F4F4F6;
  --bg-surface: #FFFFFF;
  --bg-card: #F4F4F6;

  --text-main: #2C2C2C;
  --text-muted: #666666;
  --text-title: #111111;

  --border-color: rgba(0, 0, 0, 0.08);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  --shadow-card: 0 20px 40px rgba(0, 0, 0, 0.08);

  /* Адаптивні змінні для Шапки, Героя та Підвалу (Світла тема) */
  --header-bg: rgba(255, 255, 255, 0.8);
  --header-text: #2C2C2C;
  --header-text-muted: #666666;

  --hero-overlay: linear-gradient(rgba(244, 244, 246, 0.8), rgba(244, 244, 246, 0.95));
  --hero-text: #111111;
  --hero-p: #444444;

  --footer-bg: #E4E4E8;
  --footer-text: #666666;
  --footer-link: #2C2C2C;
}

[data-theme="dark"] {
  /* СЕМАНТИКА ДЛЯ ТЕМНОЇ ТЕМИ */
  /* OLED-Оптимізація: чітке розмежування кольорів тла та карток */
  --bg-body: #141416;
  /* М'який темний колір графіту (запобігає зливанню) */
  --bg-surface: #202024;
  /* Помітно світліший відтінок для плаваючих контейнерів */
  --bg-card: #28282D;
  /* Ще світліша плашка для карток (принцип UI Elevation) */

  --text-main: #E2E2E9;
  /* М'який білий (зменшує втому очей) */
  --text-muted: #8E8E9F;
  /* Приглушений сірий */
  --text-title: #FFFFFF;
  /* Чистий білий для заголовків */

  --border-color: rgba(255, 255, 255, 0.08);
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  /* Глибша тінь для об'єму на темному тлі */
  --shadow-card: 0 20px 40px rgba(0, 0, 0, 0.5);

  /* Адаптивні змінні для Шапки, Героя та Підвалу (Темна тема) */
  --header-bg: rgba(20, 20, 22, 0.85);
  --header-text: #E2E2E9;
  --header-text-muted: #8E8E9F;

  --hero-overlay: linear-gradient(rgba(20, 20, 22, 0.65), rgba(20, 20, 22, 0.92));
  --hero-text: #FFFFFF;
  --hero-p: #E2E2E9;

  --footer-bg: #101012;
  --footer-text: #8E8E9F;
  --footer-link: #E2E2E9;
}

/* Глобальний плавний перехід між темами (додано нові елементи та властивості fill / background) */
body,
header,
.hero,
.card,
.container,
.features,
.stats-dashboard,
.container .date,
footer,
.logo-text-primary,
.logo-text-secondary,
.logo-w,
nav a,
.nav-container span,
.back-btn {
  transition: background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    background 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    fill 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   2. БАЗОВІ СТИЛІ ТА СКИДАННЯ
   ========================================================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Sofia Sans', sans-serif;
}

body {
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.7;
  word-wrap: break-word;
  hyphens: auto;
  -webkit-hyphens: auto;
  -ms-hyphens: auto;
}

.sub-page {
  margin-top: 100px;
}

/* ==========================================================================
   3. ШАПКА ТА ЛОГОТИП (HEADER & LOGO)
   ========================================================================== */

header {
  position: fixed;
  top: 0;
  width: 100%;
  background-color: var(--header-bg);
  /* Адаптивний фон шапки */
  z-index: 1000;
  padding: 15px 5%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  /* Легке розділення з контентом */

  /* Плавна анімація виїзду шапки (transform) та зміни колірних властивостей */
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

header.header-hidden {
  transform: translateY(-100%);
}

.email-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 700;
  transition: color 0.3s ease;
}

.email-link:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.logo {
  text-decoration: none;
  display: flex;
  align-items: center;
}

.logo-svg {
  height: 38px;
  width: auto;
  display: block;
  overflow: visible;
}

/* Наш золотий діамант */
.logo-diamond {
  fill: var(--primary);
  transition: fill 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: 268px 84px;
}

/* Текст першого слова ("JEWELRY") — адаптовано під тему */
.logo-text-primary {
  fill: var(--header-text);
}

/* Літера W на діаманті — тепер такого ж кольору, як і решта літер у "JEWELRY" */
.logo-w {
  fill: var(--header-text);
}

/* Друга частина тексту ("ECOSYSTEM") — адаптовано під тему */
.logo-text-secondary {
  fill: var(--header-text-muted);
}

/* Інтерактивні ефекти (Hover) логотипа */
.logo:hover .logo-diamond {
  transform: scale(1.04);
}

.logo:hover .logo-text-primary {
  fill: var(--primary);
}

.logo:hover .logo-text-secondary {
  fill: var(--text-main);
}

.logo:hover .logo-w {
  fill: var(--header-text);
}

/* ==========================================================================
   4. НАВІГАЦІЯ ТА КНОПКИ КЕРУВАННЯ (ЗМІНА ТЕМИ ТА МОВИ)
   ========================================================================== */

.nav-container {
  display: flex;
  align-items: center;
  gap: 25px;
}

nav a,
.nav-container span,
.back-btn {
  color: var(--header-text);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  transition: color 0.3s;
}

nav a:hover,
.back-btn:hover {
  color: var(--primary);
}

/* Об'єднані стилі для однакових квадратних кнопок */
.lang-switcher,
.theme-toggle-btn {
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);

  /* Ідентичні розміри (ідеальний квадрат) */
  width: 36px;
  height: 36px;
  border-radius: 4px;
  padding: 0;

  /* Флексбокс для точного центрування як літер, так і іконок */
  display: inline-flex;
  align-items: center;
  justify-content: center;

  /* Шрифтові налаштування (для кнопки мови) */
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 1;
  text-decoration: none;

  cursor: pointer;
  box-sizing: border-box;
  transition: all 0.3s ease;
}

/* Ідентична поведінка обох кнопок при наведенні */
.lang-switcher:hover,
.theme-toggle-btn:hover {
  background: var(--primary);
  color: #111111;
  /* Контрастний темний колір на золотому тлі */
}

/* Специфічний стиль для SVG всередині перемикача тем */
.theme-toggle-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  transition: transform 0.5s ease;
}

[data-theme="dark"] .theme-toggle-btn svg {
  transform: rotate(360deg);
}

/* ==========================================================================
   5. HERO СЕКЦІЯ ТА КНОПКИ (HERO & BUTTONS)
   ========================================================================== */

.hero {
  /* Градієнт тепер адаптивний (на світлій темі плавно висвітлює зображення, на темній — затемнює) */
  background: var(--hero-overlay),
    url('../images/hero-bg.jpg') no-repeat center center/cover;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 120px 20px 40px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: var(--hero-text);
  /* Адаптивний колір заголовку */
  box-sizing: border-box;
}

.hero h1 {
  font-size: 44px;
  color: var(--primary);
  margin-bottom: 20px;
  max-width: 850px;
  line-height: 1.3;
}

.hero p {
  font-size: 18px;
  max-width: 650px;
  margin-bottom: 40px;
  color: var(--hero-p);
  /* Адаптивний колір опису */
}

.btn {
  background-color: var(--primary-dark);
  color: var(--text-main);
  padding: 14px 36px;
  text-decoration: none;
  font-weight: 700;
  border-radius: 4px;
  letter-spacing: 0.5px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

.btn:hover {
  background-color: var(--primary);
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
}

/* ==========================================================================
   6. ПЕРЕВАГИ (FEATURES GRID & CARDS)
   ========================================================================== */

.features {
  padding: 60px 5%;
  background-color: var(--bg-surface);
  text-align: center;
}

.features h2 {
  display: inline-block;
  font-size: 32px;
  margin-bottom: 50px;
  color: var(--text-title);
}

.features h2::after {
  content: '';
  display: block;
  width: 100%;
  height: 3px;
  background-color: var(--primary);
  margin: 12px auto 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 30px;
  max-width: 1200px;
  margin: 0 auto;
  perspective: 1000px;
}

.card {
  background-color: var(--bg-card);
  padding: 45px 30px;
  border-radius: 6px;
  border-top: 4px solid var(--primary);
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1),
    box-shadow 0.3s ease,
    background-color 0.4s ease;
  will-change: transform;
  text-align: left;
}

.card:hover {
  transform: translateY(-8px) rotateX(4deg) rotateY(-2deg);
  box-shadow: var(--shadow-card);
}

.card h3 {
  margin-bottom: 15px;
  font-size: 21px;
  color: var(--text-title);
}

.card p {
  color: var(--text-muted);
  font-size: 15px;
}

/* ==========================================================================
   7. СТАТТІ ТА ТЕКСТОВИЙ КОНТЕНТ (CONTAINER)
   ========================================================================== */

.container {
  margin-top: 100px;
  max-width: 850px;
  margin: 60px auto;
  background: var(--bg-surface);
  padding: 50px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  /* Адаптивна тонка обводка для елегантного OLED-розділення */
}

.container h1 {
  color: var(--text-title);
  margin-bottom: 8px;
  font-size: 32px;
}

.container .date {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 35px;
  display: block;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 15px;
}

.container h2 {
  color: var(--text-title);
  margin: 35px 0 12px;
  font-size: 22px;
  position: relative;
}

.container p {
  margin-bottom: 18px;
  color: var(--text-main);
}

.container ul {
  margin-bottom: 20px;
  padding-left: 22px;
}

.container li {
  margin-bottom: 8px;
  color: var(--text-main);
}

.container p,
.container li,
.container span {
  text-align: justify;
  hyphens: auto;
  line-height: 1.6;
  hyphenate-limit-chars: 6 3 3;
  -webkit-hyphens: auto;
  -webkit-hyphenate-limit-before: 3;
  -webkit-hyphenate-limit-after: 3;
  -webkit-hyphenate-limit-chars: 6 3 3;
  -webkit-hyphenate-limit-lines: 2;
  -webkit-hyphenate-limit-last: always;
  -webkit-hyphenate-limit-zone: 8%;
  -moz-hyphens: auto;
  -moz-hyphenate-limit-chars: 6 3 3;
  -moz-hyphenate-limit-lines: 2;
  -moz-hyphenate-limit-last: always;
  -moz-hyphenate-limit-zone: 8%;
  -ms-hyphens: auto;
  -ms-hyphenate-limit-chars: 6 3 3;
  -ms-hyphenate-limit-lines: 2;
  -ms-hyphenate-limit-last: always;
  -ms-hyphenate-limit-zone: 8%;
}

/* ==========================================================================
   8. ПІДВАЛ (FOOTER)
   ========================================================================== */

footer {
  background-color: var(--footer-bg);
  /* Адаптивний фон підвалу */
  color: var(--footer-text);
  /* Адаптивний колір тексту підвалу */
  text-align: center;
  padding: 45px 20px;
  font-size: 14px;
  border-top: 1px solid var(--border-color);
  /* Адаптивна межа */
}

.footer-links {
  margin-bottom: 20px;
}

.footer-links a {
  color: var(--footer-link);
  /* Адаптивний колір посилань */
  text-decoration: none;
  margin: 0 12px;
  transition: color 0.3s;
}

.footer-links a:hover {
  color: var(--primary);
}

/* ==========================================================================
   9. КАСТОМНИЙ СКРОЛБАР
   ========================================================================== */

html {
  scrollbar-width: none;
}

html::-webkit-scrollbar {
  display: none;
}

.scroll-container {
  position: fixed;
  top: 1vh;
  bottom: 1vh;
  right: 2px;
  width: 6px;
  height: 98vh;
  z-index: 9999;
  background: transparent;
  pointer-events: auto;
}

.scroll-thumb {
  position: absolute;
  top: 0;
  right: 0;
  width: 8px;
  background-color: var(--primary);
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.8s ease-out;
  cursor: pointer;
  pointer-events: auto;
}

.scroll-thumb:hover {
  opacity: 1;
  transition: opacity 0.3s ease-in;
}

.scroll-thumb.is-scrolling {
  opacity: 1 !important;
}

/* Кнопка повернення вгору */
.top-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  background: var(--primary);
  color: #111111;
  border: none;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  font-weight: bold;
  box-shadow: var(--shadow);
  z-index: 9999;

  transition: opacity 0.5s ease, visibility 0.5s ease, filter 0.5s ease;
}

.top-btn.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.top-btn:hover {
  filter: brightness(1.15);
}

/* ==========================================================================
   10. СТАТИСТИЧНА ПАНЕЛЬ (STATS DASHBOARD)
   ========================================================================== */

.stats-dashboard {
  padding: 60px 5%;
  background-color: var(--bg-body);
  text-align: center;
  cursor: default;
}

.icon-svg {
  width: 32px;
  height: 32px;
  stroke: var(--primary);
  margin-bottom: 15px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.stats-dashboard h2 {
  display: inline-block;
  font-weight: 700;
  font-size: 36px;
  margin-bottom: 60px;
  color: var(--text-title);
}

.stats-dashboard h2::after {
  content: '';
  display: block;
  width: 100%;
  height: 3px;
  background-color: var(--primary);
  margin: 12px auto 0;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 60px;
  max-width: 1000px;
  margin: 60px auto 0;
}

.stat-card {
  position: relative;
  padding: 20px;
}

.stat-card .count {
  font-size: 56px;
  font-weight: 300;
  color: var(--text-title);
  margin-bottom: 10px;
  display: block;
  min-width: 220px;
  margin-left: auto;
  margin-right: auto;
  font-variant-numeric: tabular-nums;
}

.stat-card p {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: var(--text-muted);
  margin-bottom: 25px;
}

.progress-bg {
  width: 100px;
  height: 3px;
  background: var(--border-color);
  margin: 15px auto 0;
}

.progress-bar {
  height: 3px;
  background: var(--primary);
  width: 0%;
  transition: width 2.5s cubic-bezier(0.19, 1, 0.22, 1);
}

.stat-card:not(:last-child)::after {
  content: '';
  position: absolute;
  right: -30px;
  top: 20%;
  height: 60%;
  width: 1px;
  background: linear-gradient(to bottom, transparent, var(--primary), transparent);
}

.stat-card:hover .count {
  color: var(--primary);
  transition: color 0.5s ease;
}

/* ==========================================================================
   11. АДАПТИВНІ СТИЛІ (MEDIA QUERIES)
   ========================================================================== */

@media (max-width: 1024px) {
  .dashboard-grid {
    gap: 30px;
  }

  .stat-card .count {
    font-size: 44px;
    min-width: 150px;
  }
}

@media (max-width: 768px) {
  .sub-page {
    margin-top: 130px;
  }

  .logo-svg {
    height: 30px;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 40px;
    margin-top: 40px;
  }

  .stat-card .count {
    min-width: unset;
    font-size: 42px;
  }

  .stat-card:not(:last-child)::after {
    display: none;
  }

  .stat-card:not(:last-child) {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 40px;
  }

  .stat-card p {
    hyphens: none;
    -webkit-hyphens: none;
    letter-spacing: 1.5px;
  }

  header {
    padding: 15px 4%;
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }

  .nav-container {
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
  }

  .hero {
    min-height: 100vh;
    min-height: 100dvh;
    padding-top: 160px;
    padding-bottom: 60px;
  }

  .hero h1 {
    font-size: 28px;
    margin-bottom: 15px;
  }

  .hero p {
    font-size: 15px;
    margin-bottom: 30px;
  }

  .container {
    padding: 30px 20px;
    margin: 30px 15px;
  }

  .container h1 {
    font-size: 26px;
  }

  .scroll-thumb {
    width: 6px;
    border-radius: 3px;
  }
}